Re: [PATCH] gpio: cdev: fix kernel stack leak to user-space in error path
From: Andy Shevchenko
Date: Thu Sep 17 2026 - 12:10:56 EST
On Thu, Sep 17, 2026 at 04:39:05PM +0200, Bartosz Golaszewski wrote:
> If we fail to acquire the GPIO chip guard in gpio_desc_to_lineinfo(), we
> return immediately before zeroing the info struct we'll end up passing
> to the user-space later in lineinfo_get_v1(). This may leak the kernel
> stack contents. Move the memset() before trying to acquire the SRCU read
> lock.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
...
> unsigned long dflags;
> const char *label;
It might be not obvious for a reader, perhaps a short comment why it's done
here?
> + memset(info, 0, sizeof(*info));
--
With Best Regards,
Andy Shevchenko