All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipmi: fix suspicious RCU usage warning
@ 2025-03-12 17:19 Rik van Riel
  2025-03-12 17:29 ` Paul E. McKenney
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rik van Riel @ 2025-03-12 17:19 UTC (permalink / raw)
  To: Corey Minyard
  Cc: Paul E. McKenney, openipmi-developer, linux-kernel, kernel-team

On recent kernels this warning fires:

drivers/char/ipmi/ipmi_msghandler.c:1238 RCU-list traversed in non-reader section!!

This looks like a fairly simple lockdep trigger, where
list_for_each_entry_rcu and list_for_each_entry_srcu are
functionally identical, but the lockdep annotation in
the former has an extra check.

That extra check is whether the RCU read lock is held,
which is not true when the code uses srcu_read_lock.

Get rid of the warning by using the properly annotated
list traversal macro.

Signed-off-by: Rik van Riel <riel@surriel.com>
---
 drivers/char/ipmi/ipmi_msghandler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 1e5313748f8b..a2823763fd37 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -1235,7 +1235,7 @@ int ipmi_create_user(unsigned int          if_num,
 		return -ENOMEM;
 
 	index = srcu_read_lock(&ipmi_interfaces_srcu);
-	list_for_each_entry_rcu(intf, &ipmi_interfaces, link) {
+	list_for_each_entry_srcu(intf, &ipmi_interfaces, link) {
 		if (intf->intf_num == if_num)
 			goto found;
 	}
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-16 13:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 17:19 [PATCH] ipmi: fix suspicious RCU usage warning Rik van Riel
2025-03-12 17:29 ` Paul E. McKenney
2025-03-12 18:35   ` Paolo Bonzini
2025-03-13 19:04 ` kernel test robot
2025-03-17  9:33 ` Breno Leitao
2025-03-17 12:27   ` Corey Minyard
2025-04-16 13:18     ` Corey Minyard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.