aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJianbo Liu <[email protected]>2024-02-20 08:59:28 +0000
committerJakub Kicinski <[email protected]>2024-02-21 17:12:03 -0800
commit1fde0ca3a0de7e9f917668941156959dd5e9108b (patch)
tree70addaf895b22b1a1f77566508ee80a11faabeaf
parent61c43780e9444123410cd48c2483e01d2b8f75e8 (diff)
net/sched: flower: Add lock protection when remove filter handle
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 <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Reviewed-by: Gal Pressman <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
-rw-r--r--net/sched/cls_flower.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index efb9d2811b73..6ee7064c82fc 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -2460,8 +2460,11 @@ unbind_filter:
}
errout_idr:
- if (!fold)
+ if (!fold) {
+ spin_lock(&tp->lock);
idr_remove(&head->handle_idr, fnew->handle);
+ spin_unlock(&tp->lock);
+ }
__fl_put(fnew);
errout_tb:
kfree(tb);