Commit f76b441b authored by Matthew Daley's avatar Matthew Daley Committed by Willy Tarreau

floppy: ignore kernel-only members in FDRAWCMD ioctl input

Always clear out these floppy_raw_cmd struct members after copying the
entire structure from userspace so that the in-kernel version is always
valid and never left in an interdeterminate state.
Signed-off-by: default avatarMatthew Daley <mattd@bugfuzz.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ef87dbe7)
[wt: be careful in 2.6.32 we still have the ugly macros everywhere]
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent d751df64
...@@ -3209,9 +3209,12 @@ static inline int raw_cmd_copyin(int cmd, char __user *param, ...@@ -3209,9 +3209,12 @@ static inline int raw_cmd_copyin(int cmd, char __user *param,
if (!ptr) if (!ptr)
return -ENOMEM; return -ENOMEM;
*rcmd = ptr; *rcmd = ptr;
COPYIN(*ptr); ret = copy_from_user(ptr, (void __user *)param, sizeof(*ptr));
ptr->next = NULL; ptr->next = NULL;
ptr->buffer_length = 0; ptr->buffer_length = 0;
ptr->kernel_data = NULL;
if (ret)
return -EFAULT;
param += sizeof(struct floppy_raw_cmd); param += sizeof(struct floppy_raw_cmd);
if (ptr->cmd_count > 33) if (ptr->cmd_count > 33)
/* the command may now also take up the space /* the command may now also take up the space
......
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