Skip to contentSkip to conversation

net: airoha: add RCU lock around dev_fill_forward_path

PATCH Superseded Qingfang Deng 3 participants 4 messages Mar 19 – Mar 20

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: airoha: add RCU lock around dev_fill_forward_path

Since 0417adf367a0 ("ppp: fix race conditions in ppp_fill_forward_path") dev_fill_forward_path() should be called with RCU read lock held. This fix was applied to net, while the Airoha flowtable commit was applied to net-next, so it hadn't been an issue until net was merged into net-next.

Fixes a9af709fda7e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
---
 drivers/net/ethernet/airoha/airoha_ppe.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/airoha/airoha_ppe.c +2 -0
index ec5ce41dad80..02deb739a1c7 100644
@@ -227,7 +227,9 @@ static int airoha_ppe_get_wdma_info(struct net_device *dev, const u8 *addr,
 	if (!dev)
 		return -ENODEV;
 
+	rcu_read_lock();
 	err = dev_fill_forward_path(dev, addr, &stack);
+	rcu_read_unlock();
 	if (err)
 		return err;
 
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines

Since 0417adf367a0 ("ppp: fix race conditions in ppp_fill_forward_path") dev_fill_forward_path() should be called with RCU read lock held. This fix was applied to net, while the Airoha flowtable commit was applied to net-next, so it hadn't been an issue until net was merged into net-next.

Fixes a9af709fda7e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
Quoted 21 lines
---
 drivers/net/ethernet/airoha/airoha_ppe.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/airoha/airoha_ppe.c +2 -0
index ec5ce41dad80..02deb739a1c7 100644
@@ -227,7 +227,9 @@ static int airoha_ppe_get_wdma_info(struct net_device *dev, const u8 *addr,
 	if (!dev)
 		return -ENODEV;
 
+	rcu_read_lock();
 	err = dev_fill_forward_path(dev, addr, &stack);
+	rcu_read_unlock();
 	if (err)
 		return err;
 
Signature · 1 line
2.43.0
reviewer
#2 lore raw
In reply to Qingfang Deng
Quoted 7 lines · Qingfang Deng

Since 0417adf367a0 ("ppp: fix race conditions in ppp_fill_forward_path") dev_fill_forward_path() should be called with RCU read lock held. This fix was applied to net, while the Airoha flowtable commit was applied to net-next, so it hadn't been an issue until net was merged into net-next.

Fixes a9af709fda7e ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")

I understand from the patch description that the problem didn't manifest until this merge commit. But nonetheless I don't think using a merge commit in the Fixes tag is the best approach. For one thing, it seems somewhat difficult to use effectively to guide backporting.

I would suggest using the flowtable commit as the fixes tag:

Fixes a8bdd935d1dd ("net: airoha: Add wlan flowtable TX offload")

Or perhaps fixes tags for both a8bdd935d1dd and 0417adf367a0.

Flagged by AI generated code review, which also suggested citing a8bdd935d1dd.

...

#3 lore raw
Quoted 5 lines · Simon Horman

I understand from the patch description that the problem didn't manifest until this merge commit. But nonetheless I don't think using a merge commit in the Fixes tag is the best approach. For one thing, it seems somewhat difficult to use effectively to guide backporting.

Quoted 7 lines

I would suggest using the flowtable commit as the fixes tag:

Fixes a8bdd935d1dd ("net: airoha: Add wlan flowtable TX offload")

Or perhaps fixes tags for both a8bdd935d1dd and 0417adf367a0.

Flagged by AI generated code review, which also suggested citing a8bdd935d1dd.

Okay, I'll update the tag in v2.