+++ /dev/null
-From 50b3f1e0bb835b98de62f79e2463147dd6683e60 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Jan 2024 16:59:47 +0100
-Subject: gpiolib: remove the GPIO device from the list when it's unregistered
-
-From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-
-[ Upstream commit 48e1b4d369cfe2729138a128afa6b8a55d093eaf ]
-
-If we wait until the GPIO device's .release() callback gets invoked
-before we remove it from the global device list, then we risk that
-someone will look it up using gpio_device_find() between where we
-dropped the last reference and before .release() is done taking a
-reference again to an object that's being released.
-
-The device must be removed when it's being unregistered - just like how
-we remove it from the GPIO bus.
-
-Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
-Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpiolib.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
-index 1a53e1e5379b..0bb28867cb32 100644
---- a/drivers/gpio/gpiolib.c
-+++ b/drivers/gpio/gpiolib.c
-@@ -572,9 +572,6 @@ static void gpiodev_release(struct device *dev)
- {
- struct gpio_device *gdev = to_gpio_device(dev);
-
-- scoped_guard(mutex, &gpio_devices_lock)
-- list_del(&gdev->list);
--
- ida_free(&gpio_ida, gdev->id);
- kfree_const(gdev->label);
- kfree(gdev->descs);
-@@ -989,6 +986,9 @@ void gpiochip_remove(struct gpio_chip *gc)
- dev_crit(&gdev->dev,
- "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n");
-
-+ scoped_guard(mutex, &gpio_devices_lock)
-+ list_del(&gdev->list);
-+
- /*
- * The gpiochip side puts its use of the device to rest here:
- * if there are no userspace clients, the chardev and device will
---
-2.43.0
-
gpiolib-make-gpio_device_get-and-gpio_device_put-pub.patch
gpiolib-provide-gpio_device_find.patch
gpio-sysfs-drop-the-mention-of-gpiochip_find-from-sy.patch
-gpiolib-remove-the-gpio-device-from-the-list-when-it.patch
ib-iser-prevent-invalidating-wrong-mr.patch
drm-amdkfd-confirm-list-is-non-empty-before-utilizin.patch
drm-amd-pm-smu7-fix-a-memleak-in-smu7_hwmgr_backend_.patch
+++ /dev/null
-From f69f8332c435b5d2f7d3003513501168692e63b4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Jan 2024 16:59:47 +0100
-Subject: gpiolib: remove the GPIO device from the list when it's unregistered
-
-From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-
-[ Upstream commit 48e1b4d369cfe2729138a128afa6b8a55d093eaf ]
-
-If we wait until the GPIO device's .release() callback gets invoked
-before we remove it from the global device list, then we risk that
-someone will look it up using gpio_device_find() between where we
-dropped the last reference and before .release() is done taking a
-reference again to an object that's being released.
-
-The device must be removed when it's being unregistered - just like how
-we remove it from the GPIO bus.
-
-Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
-Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpiolib.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
-index 3518481c433f..74bcdb50c931 100644
---- a/drivers/gpio/gpiolib.c
-+++ b/drivers/gpio/gpiolib.c
-@@ -650,9 +650,6 @@ static void gpiodev_release(struct device *dev)
- {
- struct gpio_device *gdev = to_gpio_device(dev);
-
-- scoped_guard(mutex, &gpio_devices_lock)
-- list_del(&gdev->list);
--
- ida_free(&gpio_ida, gdev->id);
- kfree_const(gdev->label);
- kfree(gdev->descs);
-@@ -1067,6 +1064,9 @@ void gpiochip_remove(struct gpio_chip *gc)
- dev_crit(&gdev->dev,
- "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n");
-
-+ scoped_guard(mutex, &gpio_devices_lock)
-+ list_del(&gdev->list);
-+
- /*
- * The gpiochip side puts its use of the device to rest here:
- * if there are no userspace clients, the chardev and device will
---
-2.43.0
-
mmc-sdhci_am654-fix-ti-soc-dependencies.patch
mmc-sdhci_omap-fix-ti-soc-dependencies.patch
drm-amdkfd-fix-type-of-dbg_flags-in-struct-kfd_proce.patch
-gpiolib-remove-the-gpio-device-from-the-list-when-it.patch
ib-iser-prevent-invalidating-wrong-mr.patch
drm-amdkfd-confirm-list-is-non-empty-before-utilizin.patch
drm-amd-pm-smu7-fix-a-memleak-in-smu7_hwmgr_backend_.patch