diff options
author | Matthew Daley <mattd@bugfuzz.com> | 2014-04-28 19:05:21 +1200 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-05-15 09:55:49 +0200 |
commit | 3d43edf5868f260dbfd1353bf243a78f030a08b0 (patch) | |
tree | f33870e88c41da168cfd2fecb3537ca9e1b56da0 /drivers/block | |
parent | 36cdf95db237630373162e20142df4d11efdd543 (diff) |
floppy: don't write kernel-only members to FDRAWCMD ioctl output
commit 2145e15e0557a01b9195d1c7199a1b92cb9be81f upstream.
Do not leak kernel-only floppy_raw_cmd structure members to userspace.
This includes the linked-list pointer and the pointer to the allocated
DMA space.
Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/floppy.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index b836e1a9047..cf3e5042193 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3053,7 +3053,10 @@ static int raw_cmd_copyout(int cmd, void __user *param, int ret; while (ptr) { - ret = copy_to_user(param, ptr, sizeof(*ptr)); + struct floppy_raw_cmd cmd = *ptr; + cmd.next = NULL; + cmd.kernel_data = NULL; + ret = copy_to_user(param, &cmd, sizeof(cmd)); if (ret) return -EFAULT; param += sizeof(struct floppy_raw_cmd); |