[SRU][J:linux-bluefield][PATCH v1 3/3] UBUNTU: SAUCE: Revert "can: gw: use call_rcu() instead of costly synchronize_rcu()"

Stav Aviram saviram at nvidia.com
Thu Jul 17 14:27:04 UTC 2025


BugLink: https://bugs.launchpad.net/bugs/2117163

Revert a commit that was introduced as a part of a series to the stable
release of v5.15.183 and was taken into tag
Ubuntu-bluefield-5.15.0-1071.73.

Remove this series as it added k[v]free_rcu_mightsleep() to BF5.15,
causing HAVE_KFREE_RCU_MIGHTSLEEP to become defined and triggering a
crash due to premature use of the new APIs:

Oops: 0000 [#1] SMP NOPTI
...
Workqueue: events kfree_rcu_work
RIP: 0010:kmem_cache_free_bulk+0x137/0x1d0
...
Call Trace:

 kfree_rcu_work+0x1e7/0x250
 process_one_work+0x1b0/0x350
 worker_thread+0x50/0x3a0
 ? process_one_work+0x350/0x350
 kthread+0x124/0x150

This reverts commit 82683fabcb288352f8e6b339708a6370982737eb.

Issue: 4530194
Signed-off-by: Stav Aviram <saviram at nvidia.com>
---
 net/can/gw.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/net/can/gw.c b/net/can/gw.c
index 20e74fe7d090..d8861e862f15 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -577,13 +577,6 @@ static inline void cgw_unregister_filter(struct net *net, struct cgw_job *gwj)
 			  gwj->ccgw.filter.can_mask, can_can_gw_rcv, gwj);
 }
 
-static void cgw_job_free_rcu(struct rcu_head *rcu_head)
-{
-	struct cgw_job *gwj = container_of(rcu_head, struct cgw_job, rcu);
-
-	kmem_cache_free(cgw_cache, gwj);
-}
-
 static int cgw_notifier(struct notifier_block *nb,
 			unsigned long msg, void *ptr)
 {
@@ -603,7 +596,8 @@ static int cgw_notifier(struct notifier_block *nb,
 			if (gwj->src.dev == dev || gwj->dst.dev == dev) {
 				hlist_del(&gwj->list);
 				cgw_unregister_filter(net, gwj);
-				call_rcu(&gwj->rcu, cgw_job_free_rcu);
+				synchronize_rcu();
+				kmem_cache_free(cgw_cache, gwj);
 			}
 		}
 	}
@@ -1161,7 +1155,8 @@ static void cgw_remove_all_jobs(struct net *net)
 	hlist_for_each_entry_safe(gwj, nx, &net->can.cgw_list, list) {
 		hlist_del(&gwj->list);
 		cgw_unregister_filter(net, gwj);
-		call_rcu(&gwj->rcu, cgw_job_free_rcu);
+		synchronize_rcu();
+		kmem_cache_free(cgw_cache, gwj);
 	}
 }
 
@@ -1229,7 +1224,8 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 		hlist_del(&gwj->list);
 		cgw_unregister_filter(net, gwj);
-		call_rcu(&gwj->rcu, cgw_job_free_rcu);
+		synchronize_rcu();
+		kmem_cache_free(cgw_cache, gwj);
 		err = 0;
 		break;
 	}
-- 
2.38.1




More information about the kernel-team mailing list