staging/bcm: two information leaks in ioctl
Subsystems (2)
PATCH 1/2 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.
drivers/staging/bcm/Bcmchar.c +4 -0
@@ -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_aif (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 ;
Quoted 2 lines · Dan Carpenter
There are a couple paths where we don't check how much data we copy back to the user.
I'm curious, is this something smatch is only picking up now that I chopped up that mega function into lots of little functions ?
Dave
Quoted 6 lines · Dave Jones
Quoted 2 lines · Dan Carpenter
There are a couple paths where we don't check how much data we copy back to the user.
I'm curious, is this something smatch is only picking up now that I chopped up that mega function into lots of little functions ?
Yes. Smatch wasn't able to parse it before the breakup. Too huge.
regards,
dan carpenter
Quoted 9 lines · Dan Carpenter
Quoted 6 lines · Dave Jones
Quoted 2 lines · Dan Carpenter
There are a couple paths where we don't check how much data we copy back to the user.
I'm curious, is this something smatch is only picking up now that I chopped up that mega function into lots of little functions ?
Yes. Smatch wasn't able to parse it before the breakup. Too huge.
Excellent. That gives me incentive to do that sort of crap work more often.
Dave