diff options
author | Matthew Daley <mattd@bugfuzz.com> | 2014-04-28 19:05:21 +1200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2014-05-19 07:54:39 +0200 |
commit | f0fa6c0306fc48c9b982c412e926b284906ba62d (patch) | |
tree | bef20d7baa3a103066302d4dd353502076e57865 | |
parent | f76b441b9d5879587f53525933d27b16217ca78c (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>
(cherry picked from commit 2145e15e0557a01b9195d1c7199a1b92cb9be81f)
Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r-- | drivers/block/floppy.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 19d45e6c2b9b..f959aad30ca1 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3162,7 +3162,12 @@ static inline int raw_cmd_copyout(int cmd, char __user *param, int ret; while (ptr) { - COPYOUT(*ptr); + struct floppy_raw_cmd cmd = *ptr; + cmd.next = NULL; + cmd.kernel_data = NULL; + ret = copy_to_user((void __user *)param, &cmd, sizeof(cmd)); + if (ret) + return -EFAULT; param += sizeof(struct floppy_raw_cmd); if ((ptr->flags & FD_RAW_READ) && ptr->buffer_length) { if (ptr->length >= 0 |