summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Daley <mattd@bugfuzz.com>2014-04-28 19:05:21 +1200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-13 13:59:40 +0200
commit50c648e394a0968f19d448b70bec82da88219963 (patch)
treec3fa3437dca1957c6ee33d1ec1f7c08f956ea7d5
parent21506304588afab20b2d52aaa56b70e85aca6386 (diff)
downloadlinux-3.10-50c648e394a0968f19d448b70bec82da88219963.tar.gz
linux-3.10-50c648e394a0968f19d448b70bec82da88219963.tar.bz2
linux-3.10-50c648e394a0968f19d448b70bec82da88219963.zip
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 1a8ab67d165..eb3575b3fbf 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);