summaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-05-19 17:17:45 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-27 09:44:02 +0300
commita7890637b3b9b485ffd6a8bfc4276fab03b8e9f5 (patch)
tree2793e8933ae6e0610af3ce3ebe8a312c35e4595e /drivers/w1
parenta27aeae714cdf7249914a57e14627581cefc1336 (diff)
downloadlinux-a7890637b3b9b485ffd6a8bfc4276fab03b8e9f5.tar.xz
w1: fix loop in w1_fini()
[ Upstream commit 83f3fcf96fcc7e5405b37d9424c7ef26bfa203f8 ] The __w1_remove_master_device() function calls: list_del(&dev->w1_master_entry); So presumably this can cause an endless loop. Fixes: 7785925dd8e0 ("[PATCH] w1: cleanups.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/w1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 15842377c8d2..1c1a9438f4b6 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -1228,10 +1228,10 @@ err_out_exit_init:
static void __exit w1_fini(void)
{
- struct w1_master *dev;
+ struct w1_master *dev, *n;
/* Set netlink removal messages and some cleanup */
- list_for_each_entry(dev, &w1_masters, w1_master_entry)
+ list_for_each_entry_safe(dev, n, &w1_masters, w1_master_entry)
__w1_remove_master_device(dev);
w1_fini_netlink();