]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: GPIO_GET_LINEHANDLE_IOCTL: Validate line offset
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 18 Oct 2016 14:54:01 +0000 (16:54 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 21 Oct 2016 12:39:18 +0000 (14:39 +0200)
commite405f9fcb63602d35f7a419ededa3f952a395a72
tree8ccb8cecafdc1b92ddfcdcfe9be26c71e07a45dd
parent0f4bbb233743bdfd51d47688b0bc2561f310488b
gpio: GPIO_GET_LINEHANDLE_IOCTL: Validate line offset

The line offset that is used as an index into the descs array is provided
by userspace and might go beyond the bounds of the array. If that happens
undefined behavior will occur.

Make sure that the offset is within the bounds of the desc array and reject
any requests that specify a value outside of it.

Cc: stable@vger.kernel.org
Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c