Commit cc1fa4a7 authored by Linus Walleij's avatar Linus Walleij Committed by Greg Kroah-Hartman

gpio: Fix kernel stack leak to userspace

commit 24bd3efc 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: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 241c04f7
...@@ -705,6 +705,9 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) ...@@ -705,6 +705,9 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
struct gpioevent_data ge; struct gpioevent_data ge;
int ret, level; int ret, level;
/* Do not leak kernel stack to userspace */
memset(&ge, 0, sizeof(ge));
ge.timestamp = ktime_get_real_ns(); ge.timestamp = ktime_get_real_ns();
level = gpiod_get_value_cansleep(le->desc); level = gpiod_get_value_cansleep(le->desc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment