diff options
author | Matthew Daley <mattd@bugfuzz.com> | 2014-04-28 03:05:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-05 10:46:56 -0400 |
commit | 2145e15e0557a01b9195d1c7199a1b92cb9be81f (patch) | |
tree | 5c9f4d9d23feb63d2a1eef1ec56a4f1138c973d8 | |
parent | ef87dbe7614341c2e7bfe8d32fcb7028cc97442c (diff) |
floppy: don't write kernel-only members to FDRAWCMD ioctl output
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>
-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 12251a688871..fa9bb742df6e 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3067,7 +3067,10 @@ static int raw_cmd_copyout(int cmd, void __user *param, | |||
3067 | int ret; | 3067 | int ret; |
3068 | 3068 | ||
3069 | while (ptr) { | 3069 | while (ptr) { |
3070 | ret = copy_to_user(param, ptr, sizeof(*ptr)); | 3070 | struct floppy_raw_cmd cmd = *ptr; |
3071 | cmd.next = NULL; | ||
3072 | cmd.kernel_data = NULL; | ||
3073 | ret = copy_to_user(param, &cmd, sizeof(cmd)); | ||
3071 | if (ret) | 3074 | if (ret) |
3072 | return -EFAULT; | 3075 | return -EFAULT; |
3073 | param += sizeof(struct floppy_raw_cmd); | 3076 | param += sizeof(struct floppy_raw_cmd); |