Re: [PATCH] gpio: sysfs: add missing mutex_destroy()

From: Johan Hovold
Date: Fri May 16 2025 - 07:42:25 EST


On Fri, May 16, 2025 at 12:40:23PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> We initialize the data->mutex in gpiod_export() but lack the
> corresponding mutex_destroy() in gpiod_unexport() causing a resource
> leak with mutex debugging enabled. Add the call right before kfreeing
> the GPIO data.

No, there's no resource leak and it's perfectly fine not to call
mutex_destroy().

You can't just make shit up and then pretend to fix it...

> Fixes: 6ffcb7971486 ("gpio: sysfs: use per-gpio locking")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>

Johan