compat_hdio_ioctl: get rid of set_fs()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>hifive-unleashed-5.1
parent
229b53c9bf
commit
30138384da
|
@ -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,
|
static int compat_hdio_ioctl(struct block_device *bdev, fmode_t mode,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
mm_segment_t old_fs = get_fs();
|
unsigned long *__user p;
|
||||||
unsigned long kval;
|
|
||||||
unsigned int __user *uvp;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
set_fs(KERNEL_DS);
|
p = compat_alloc_user_space(sizeof(unsigned long));
|
||||||
error = __blkdev_driver_ioctl(bdev, mode,
|
error = __blkdev_driver_ioctl(bdev, mode,
|
||||||
cmd, (unsigned long)(&kval));
|
cmd, (unsigned long)p);
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
uvp = compat_ptr(arg);
|
unsigned int __user *uvp = compat_ptr(arg);
|
||||||
if (put_user(kval, uvp))
|
unsigned long v;
|
||||||
|
if (get_user(v, p) || put_user(v, uvp))
|
||||||
error = -EFAULT;
|
error = -EFAULT;
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
|
Loading…
Reference in New Issue