diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2018-01-22 13:19:28 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-03 17:38:48 +0100 |
commit | c5845e025423b02235489f154903b8befabebb02 (patch) | |
tree | d0f6f44e0e019495862d641c7d579b0c3c6a8921 | |
parent | 460c5b9745b8b455be5591b1179e89a8bdcb1afd (diff) | |
download | linux-stable-c5845e025423b02235489f154903b8befabebb02.tar.gz linux-stable-c5845e025423b02235489f154903b8befabebb02.tar.bz2 linux-stable-c5845e025423b02235489f154903b8befabebb02.zip |
gpio: Fix kernel stack leak to userspace
commit 24bd3efc9d1efb5f756a7c6f807a36ddb6adc671 upstream.
The GPIO event descriptor was leaking kernel stack to
userspace because we don't zero the variable before
use. Ooops. Fix this.
Reported-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/gpio/gpiolib.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index eb80dac4e26a..bdd68ff197dc 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -723,6 +723,9 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) struct gpioevent_data ge; int ret, level; + /* Do not leak kernel stack to userspace */ + memset(&ge, 0, sizeof(ge)); + ge.timestamp = ktime_get_real_ns(); level = gpiod_get_value_cansleep(le->desc); |