compat_hdio_ioctl: get rid of set_fs()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 30138384 229b53c9

+6 -9
+6 -9
block/compat_ioctl.c
··· 79 static int compat_hdio_ioctl(struct block_device *bdev, fmode_t mode, 80 unsigned int cmd, unsigned long arg) 81 { 82 - mm_segment_t old_fs = get_fs(); 83 - unsigned long kval; 84 - unsigned int __user *uvp; 85 int error; 86 87 - set_fs(KERNEL_DS); 88 error = __blkdev_driver_ioctl(bdev, mode, 89 - cmd, (unsigned long)(&kval)); 90 - set_fs(old_fs); 91 - 92 if (error == 0) { 93 - uvp = compat_ptr(arg); 94 - if (put_user(kval, uvp)) 95 error = -EFAULT; 96 } 97 return error;
··· 79 static int compat_hdio_ioctl(struct block_device *bdev, fmode_t mode, 80 unsigned int cmd, unsigned long arg) 81 { 82 + unsigned long *__user p; 83 int error; 84 85 + p = compat_alloc_user_space(sizeof(unsigned long)); 86 error = __blkdev_driver_ioctl(bdev, mode, 87 + cmd, (unsigned long)p); 88 if (error == 0) { 89 + unsigned int __user *uvp = compat_ptr(arg); 90 + unsigned long v; 91 + if (get_user(v, p) || put_user(v, uvp)) 92 error = -EFAULT; 93 } 94 return error;