lkml.org 
[lkml]   [2021]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] w1: fix loop in w1_fini()
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>
---
drivers/w1/w1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index f2ae2e563dc5..8b2d82959ded 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -1259,10 +1259,10 @@ static int __init w1_init(void)

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();
--
2.30.2
\
 
 \ /
  Last update: 2021-05-19 16:18    [W:0.087 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site