diff options
author | Matthew Daley <mattd@bugfuzz.com> | 2014-04-28 19:05:20 +1200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-13 13:59:40 +0200 |
commit | 21506304588afab20b2d52aaa56b70e85aca6386 (patch) | |
tree | b54ddcabf5be8cfa8b39bd7856f8c00f2bb412e9 /drivers/block | |
parent | abb5100737bba3f82b5514350fea89ca361ac66c (diff) | |
download | linux-3.10-21506304588afab20b2d52aaa56b70e85aca6386.tar.gz linux-3.10-21506304588afab20b2d52aaa56b70e85aca6386.tar.bz2 linux-3.10-21506304588afab20b2d52aaa56b70e85aca6386.zip |
floppy: ignore kernel-only members in FDRAWCMD ioctl input
commit ef87dbe7614341c2e7bfe8d32fcb7028cc97442c upstream.
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: Matthew Daley <mattd@bugfuzz.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/floppy.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 04ceb7e2fad..1a8ab67d165 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3107,10 +3107,11 @@ loop: return -ENOMEM; *rcmd = ptr; ret = copy_from_user(ptr, param, sizeof(*ptr)); - if (ret) - return -EFAULT; ptr->next = NULL; ptr->buffer_length = 0; + ptr->kernel_data = NULL; + if (ret) + return -EFAULT; param += sizeof(struct floppy_raw_cmd); if (ptr->cmd_count > 33) /* the command may now also take up the space @@ -3126,7 +3127,6 @@ loop: for (i = 0; i < 16; i++) ptr->reply[i] = 0; ptr->resultcode = 0; - ptr->kernel_data = NULL; if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { if (ptr->length <= 0) |