This is a note to let you know that I've just added the patch titled cdx: Unlock on error path in rescan_store() to the 6.7-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cdx-unlock-on-error-path-in-rescan_store.patch and it can be found in the queue-6.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 5634c3f7461116e9eb1fb338a3eaab380ae8cc8c Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Tue Jan 2 16:11:16 2024 +0300 cdx: Unlock on error path in rescan_store() [ Upstream commit 1960932eef9183e2dab662fe75126f7fa46e0e6d ] We added locking to this function but these two error paths were accidentally overlooked. Fixes: f0af81683466 ("cdx: Introduce lock to protect controller ops") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Acked-by: Abhijit Gangurde <abhijit.gangurde@xxxxxxx> Link: https://lore.kernel.org/r/a7994b47-6f78-4e2c-a30a-ee5995d428ec@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c index 40035dd2e299..7c1c1f82a326 100644 --- a/drivers/cdx/cdx.c +++ b/drivers/cdx/cdx.c @@ -575,7 +575,8 @@ static ssize_t rescan_store(const struct bus_type *bus, pd = of_find_device_by_node(np); if (!pd) { of_node_put(np); - return -EINVAL; + count = -EINVAL; + goto unlock; } cdx = platform_get_drvdata(pd); @@ -585,6 +586,7 @@ static ssize_t rescan_store(const struct bus_type *bus, put_device(&pd->dev); } +unlock: mutex_unlock(&cdx_controller_lock); return count;