diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2018-01-22 13:19:28 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-01-23 14:43:45 +0100 |
commit | 24bd3efc9d1efb5f756a7c6f807a36ddb6adc671 (patch) | |
tree | 80b9be8d100ed71c1754150950e4c61033cb59de /drivers/gpio/gpiolib.c | |
parent | 2046362cf11d3dcb0c6904f7f3209c568d7858b3 (diff) | |
download | op-kernel-dev-24bd3efc9d1efb5f756a7c6f807a36ddb6adc671.zip op-kernel-dev-24bd3efc9d1efb5f756a7c6f807a36ddb6adc671.tar.gz |
gpio: Fix kernel stack leak to userspace
The GPIO event descriptor was leaking kernel stack to
userspace because we don't zero the variable before
use. Ooops. Fix this.
Cc: stable@vger.kernel.org
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>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-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 37e31ba..754836e4 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -744,6 +744,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); |