summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKevin McKinney <klmckinney1@gmail.com>2011-09-18 22:34:46 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-19 17:46:17 (GMT)
commit5ac5bd8754b3dabcf4aea7b5f4a28a1d8494a1b0 (patch)
tree06f2a5c39a9158f62c9cf78addb4269cd2c8e54f /drivers
parent7518b9b8fc72a6c0ba67f33bdd4689c7dd28686a (diff)
downloadlinux-5ac5bd8754b3dabcf4aea7b5f4a28a1d8494a1b0.tar.xz
Staging: bcm: Add size minimum size restrictions for IOCTL_IDLE_REQ
If IoBuffer.InputLength is zero then this will cause an Oops when we dereference the ZERO_SIZE_PTR. Or if it's smaller than sizeof(struct link_request) then we would get memory corruption when we set ->PLength in CopyBufferToControlPacket(). Signed-off-by: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/bcm/Bcmchar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index 6f8a75d..1905a83 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -687,7 +687,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
return -EFAULT;
- /* FIXME: don't accept any length from user */
+ if (IoBuffer.InputLength < sizeof(struct link_request))
+ return -EINVAL;
+
pvBuffer = kmalloc(IoBuffer.InputLength, GFP_KERNEL);
if (!pvBuffer)
return -ENOMEM;