Skip to content

Commit

Permalink
gpio: Fix kernel stack leak to userspace
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Walleij committed Jan 23, 2018
1 parent 2046362 commit 24bd3ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 24bd3ef

Please sign in to comment.