[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250516104023.20561-1-brgl@bgdev.pl>
Date: Fri, 16 May 2025 12:40:23 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Johan Hovold <johan@...nel.org>
Cc: linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
stable@...r.kernel.org
Subject: [PATCH] gpio: sysfs: add missing mutex_destroy()
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
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.
Fixes: 6ffcb7971486 ("gpio: sysfs: use per-gpio locking")
Cc: stable@...r.kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
---
drivers/gpio/gpiolib-sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 4a3aa09dad9d..cd3381a4bc93 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -713,6 +713,7 @@ void gpiod_unexport(struct gpio_desc *desc)
}
put_device(dev);
+ mutex_destroy(&data->mutex);
kfree(data);
}
EXPORT_SYMBOL_GPL(gpiod_unexport);
--
2.45.2
Powered by blists - more mailing lists