]> 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)
commitaa51a033bb0b185d42b99f216626bf66ec46eb0c
tree8ccb8cecafdc1b92ddfcdcfe9be26c71e07a45dd
parent7ece85cb13ba51cd9f87384bda78bfd29497b61a
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: 8467f6ad9e2e ("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