aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r--drivers/md/dm-ioctl.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 4aa1f78b78f0..9c491397a51d 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/dm-ioctl.h> 16#include <linux/dm-ioctl.h>
17#include <linux/hdreg.h> 17#include <linux/hdreg.h>
18#include <linux/compat.h>
18 19
19#include <asm/uaccess.h> 20#include <asm/uaccess.h>
20 21
@@ -1350,10 +1351,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
1350{ 1351{
1351 struct dm_ioctl tmp, *dmi; 1352 struct dm_ioctl tmp, *dmi;
1352 1353
1353 if (copy_from_user(&tmp, user, sizeof(tmp))) 1354 if (copy_from_user(&tmp, user, sizeof(tmp) - sizeof(tmp.data)))
1354 return -EFAULT; 1355 return -EFAULT;
1355 1356
1356 if (tmp.data_size < sizeof(tmp)) 1357 if (tmp.data_size < (sizeof(tmp) - sizeof(tmp.data)))
1357 return -EINVAL; 1358 return -EINVAL;
1358 1359
1359 dmi = vmalloc(tmp.data_size); 1360 dmi = vmalloc(tmp.data_size);
@@ -1474,8 +1475,18 @@ static long dm_ctl_ioctl(struct file *file, uint command, ulong u)
1474 return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u); 1475 return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u);
1475} 1476}
1476 1477
1478#ifdef CONFIG_COMPAT
1479static long dm_compat_ctl_ioctl(struct file *file, uint command, ulong u)
1480{
1481 return (long)dm_ctl_ioctl(file, command, (ulong) compat_ptr(u));
1482}
1483#else
1484#define dm_compat_ctl_ioctl NULL
1485#endif
1486
1477static const struct file_operations _ctl_fops = { 1487static const struct file_operations _ctl_fops = {
1478 .unlocked_ioctl = dm_ctl_ioctl, 1488 .unlocked_ioctl = dm_ctl_ioctl,
1489 .compat_ioctl = dm_compat_ctl_ioctl,
1479 .owner = THIS_MODULE, 1490 .owner = THIS_MODULE,
1480}; 1491};
1481 1492