提交 2145e15e 编写于 作者: M Matthew Daley 提交者: 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: NMatthew Daley <mattd@bugfuzz.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册