summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-02-17 22:56:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-18 11:18:09 -0800
commitcfff3e5c8d2139c38d40d90e3d9fc13721222076 (patch)
tree70001ff7173b3ab8693167abb6e6c84490b4b89e
parent4e5e9d7c66f045558d5f70f640de0093fcd875e8 (diff)
staging/bcm: two information leaks in ioctl
There are a couple paths where we don't check how much data we copy back to the user. Cc: Dave Jones <davej@redhat.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/bcm/Bcmchar.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index fdebc3bba0b5..6f1997dc44c8 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -590,6 +590,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp, struct bcm_mini_
if (IoBuffer.InputLength > sizeof(gpio_multi_info))
return -EINVAL;
+ if (IoBuffer.OutputLength > sizeof(gpio_multi_info))
+ IoBuffer.OutputLength = sizeof(gpio_multi_info);
if (copy_from_user(&gpio_multi_info, IoBuffer.InputBuffer, IoBuffer.InputLength))
return -EFAULT;
@@ -680,6 +682,8 @@ static int bcm_char_ioctl_gpio_mode_request(void __user *argp, struct bcm_mini_a
if (IoBuffer.InputLength > sizeof(gpio_multi_mode))
return -EINVAL;
+ if (IoBuffer.OutputLength > sizeof(gpio_multi_mode))
+ IoBuffer.OutputLength = sizeof(gpio_multi_mode);
if (copy_from_user(&gpio_multi_mode, IoBuffer.InputBuffer, IoBuffer.InputLength))
return -EFAULT;