Commit 2145e15e authored by Matthew Daley's avatar Matthew Daley Committed by Linus Torvalds

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: default avatarMatthew Daley <mattd@bugfuzz.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ef87dbe7
...@@ -3067,7 +3067,10 @@ static int raw_cmd_copyout(int cmd, void __user *param, ...@@ -3067,7 +3067,10 @@ static int raw_cmd_copyout(int cmd, void __user *param,
int ret; int ret;
while (ptr) { 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) if (ret)
return -EFAULT; return -EFAULT;
param += sizeof(struct floppy_raw_cmd); param += sizeof(struct floppy_raw_cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment