]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2016 15:38:45 +0000 (16:38 +0100)
commite22edf53b40fabd70ed61d4c1d1f6dc4cfdbb8ef
treea181ec8c77f8ad98918c486fc204151fb317e9ac
parenta23a59c56a53db7339e89b0b8b10edf79d1d0865
gpio: GPIO_GET_LINEHANDLE_IOCTL: Validate line offset

commit e405f9fcb63602d35f7a419ededa3f952a395a72 upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpiolib.c