[SRU][J:linux-bluefield][PATCH 1/1] net/sched: flower: Add lock protection when remove filter handle
William Tu
witu at nvidia.com
Mon Feb 26 23:02:30 UTC 2024
From: Jianbo Liu <jianbol at nvidia.com>
BugLink: https://bugs.launchpad.net/bugs/2055052
As IDR can't protect itself from the concurrent modification, place
idr_remove() under the protection of tp->lock.
Fixes: 08a0063df3ae ("net/sched: flower: Move filter handle initialization earlier")
Signed-off-by: Jianbo Liu <jianbol at nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu at nvidia.com>
Reviewed-by: Gal Pressman <gal at nvidia.com>
Reviewed-by: Jiri Pirko <jiri at nvidia.com>
Acked-by: Jamal Hadi Salim <jhs at mojatatu.com>
Link: https://lore.kernel.org/r/20240220085928.9161-1-jianbol@nvidia.com
Signed-off-by: Jakub Kicinski <kuba at kernel.org>
(Backported from commit 1fde0ca3a0de7e9f917668941156959dd5e9108b)
[witu: resolve trivial conflicts in net/sched/cls_flower.c]
Signed-off-by: William Tu <witu at nvidia.com>
---
net/sched/cls_flower.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 323d8bf02fa6..a2361b632a09 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -2196,9 +2196,11 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
errout_mask:
fl_mask_put(head, fnew->mask);
errout_idr:
- if (!fold)
+ if (!fold) {
+ spin_lock(&tp->lock);
idr_remove(&head->handle_idr, fnew->handle);
-errout:
+ spin_unlock(&tp->lock);
+ }
__fl_put(fnew);
errout_tb:
kfree(tb);
--
2.37.1 (Apple Git-137.1)
More information about the kernel-team
mailing list