From f2c2fb50be13aca9c449d9156817c915d9cd2acb Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 5 Jul 2016 16:36:29 +0100 Subject: linux-user: Correct type for LOOP_GET_STATUS{,64} ioctls The LOOP_GET_STATUS and LOOP_GET_STATUS64 ioctls were incorrectly defined as IOC_W rather than IOC_R, which meant we weren't correctly copying the information back from the kernel to the guest. The loop_info64 structure definition was also missing a member and using the wrong type for several 32-bit fields. In particular, this meant that "kpartx -d image.img" didn't work and "losetup -a" behaved strangely. Correct the ioctl type definitions. Reported-by: Chanho Park Reviewed-by: Laurent Vivier Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/ioctls.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux-user/ioctls.h') diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index a066d9b3f6..33ede9cd9e 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -322,9 +322,9 @@ IOCTL(LOOP_SET_FD, 0, TYPE_INT) IOCTL(LOOP_CLR_FD, 0, TYPE_INT) IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info))) - IOCTL(LOOP_GET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info))) + IOCTL(LOOP_GET_STATUS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info))) IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) - IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) + IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT) IOCTL(LOOP_CTL_ADD, 0, TYPE_INT) -- cgit v1.2.3