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: [email protected]
Reported-by: Arnd Bergmann <[email protected]>
Reviewed-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
Linus Walleij 2018-01-22 13:19:28 +01:00
commit 24bd3efc9d

View file

@ -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);