diff options
author | Matthew Daley <mattd@bugfuzz.com> | 2014-04-28 19:05:21 +1200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2014-05-18 14:58:10 +0100 |
commit | 629cbea2961ec001a85a4ac8821dcd45226dd29c (patch) | |
tree | a7f00d0b52afc136b116b8b5377472d4be2521f5 | |
parent | d79119d4089defc81a49c6a7e26ff5ff86f4b342 (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: Ben Hutchings <ben@decadent.org.uk>
-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 56490fe6c0e..6d0f3e13822 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3060,7 +3060,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); |