Skip to content

Commit

Permalink
compat_hdio_ioctl: get rid of set_fs()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jun 29, 2017
1 parent 229b53c commit 3013838
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions block/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3013838

Please sign in to comment.