summaryrefslogtreecommitdiffstats
path: root/drivers/block/floppy.c
diff options
context:
space:
mode:
authorMatthew Daley <mattd@bugfuzz.com>2014-04-28 09:05:21 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2014-05-05 16:46:56 +0200
commit2145e15e0557a01b9195d1c7199a1b92cb9be81f (patch)
tree5c9f4d9d23feb63d2a1eef1ec56a4f1138c973d8 /drivers/block/floppy.c
parentfloppy: ignore kernel-only members in FDRAWCMD ioctl input (diff)
downloadlinux-2145e15e0557a01b9195d1c7199a1b92cb9be81f.tar.xz
linux-2145e15e0557a01b9195d1c7199a1b92cb9be81f.zip
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>
Diffstat (limited to '')
-rw-r--r--drivers/block/floppy.c5
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,
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);