diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-06-27 21:51:38 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-06-30 00:17:52 +0200 |
commit | 30138384dae74cdd5694615c098a19af984a3dda (patch) | |
tree | 88f528ca5ea0c9cd09c2c612a587a1b263628ae0 /block/compat_ioctl.c | |
parent | take floppy compat ioctls to sodding floppy.c (diff) | |
download | linux-30138384dae74cdd5694615c098a19af984a3dda.tar.xz linux-30138384dae74cdd5694615c098a19af984a3dda.zip |
compat_hdio_ioctl: get rid of set_fs()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/compat_ioctl.c')
-rw-r--r-- | block/compat_ioctl.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index 696e0cdd2df1..38554c2ea38a 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c @@ -79,19 +79,16 @@ static int compat_hdio_getgeo(struct gendisk *disk, struct block_device *bdev, static int compat_hdio_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { - mm_segment_t old_fs = get_fs(); - unsigned long kval; - unsigned int __user *uvp; + unsigned long *__user p; int error; - set_fs(KERNEL_DS); + p = compat_alloc_user_space(sizeof(unsigned long)); error = __blkdev_driver_ioctl(bdev, mode, - cmd, (unsigned long)(&kval)); - set_fs(old_fs); - + cmd, (unsigned long)p); if (error == 0) { - uvp = compat_ptr(arg); - if (put_user(kval, uvp)) + unsigned int __user *uvp = compat_ptr(arg); + unsigned long v; + if (get_user(v, p) || put_user(v, uvp)) error = -EFAULT; } return error; |