diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/compat_ioctl.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index 5c6dafaad938..44807d38b1e7 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
@@ -92,6 +92,35 @@ static int compat_hdio_ioctl(struct inode *inode, struct file *file, | |||
92 | return error; | 92 | return error; |
93 | } | 93 | } |
94 | 94 | ||
95 | struct compat_blkpg_ioctl_arg { | ||
96 | compat_int_t op; | ||
97 | compat_int_t flags; | ||
98 | compat_int_t datalen; | ||
99 | compat_caddr_t data; | ||
100 | }; | ||
101 | |||
102 | static int compat_blkpg_ioctl(struct inode *inode, struct file *file, | ||
103 | unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32) | ||
104 | { | ||
105 | struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a)); | ||
106 | compat_caddr_t udata; | ||
107 | compat_int_t n; | ||
108 | int err; | ||
109 | |||
110 | err = get_user(n, &ua32->op); | ||
111 | err |= put_user(n, &a->op); | ||
112 | err |= get_user(n, &ua32->flags); | ||
113 | err |= put_user(n, &a->flags); | ||
114 | err |= get_user(n, &ua32->datalen); | ||
115 | err |= put_user(n, &a->datalen); | ||
116 | err |= get_user(udata, &ua32->data); | ||
117 | err |= put_user(compat_ptr(udata), &a->data); | ||
118 | if (err) | ||
119 | return err; | ||
120 | |||
121 | return blkdev_ioctl(inode, file, cmd, (unsigned long)a); | ||
122 | } | ||
123 | |||
95 | #define BLKBSZGET_32 _IOR(0x12, 112, int) | 124 | #define BLKBSZGET_32 _IOR(0x12, 112, int) |
96 | #define BLKBSZSET_32 _IOW(0x12, 113, int) | 125 | #define BLKBSZSET_32 _IOW(0x12, 113, int) |
97 | #define BLKGETSIZE64_32 _IOR(0x12, 114, int) | 126 | #define BLKGETSIZE64_32 _IOR(0x12, 114, int) |
@@ -348,6 +377,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
348 | case BLKBSZSET_32: | 377 | case BLKBSZSET_32: |
349 | return blkdev_ioctl(inode, file, BLKBSZSET, | 378 | return blkdev_ioctl(inode, file, BLKBSZSET, |
350 | (unsigned long)compat_ptr(arg)); | 379 | (unsigned long)compat_ptr(arg)); |
380 | case BLKPG: | ||
381 | return compat_blkpg_ioctl(inode, file, cmd, compat_ptr(arg)); | ||
351 | } | 382 | } |
352 | 383 | ||
353 | lock_kernel(); | 384 | lock_kernel(); |