Skip to content

Commit 1fde0ca

Browse files
Jianbo Liukuba-moo
authored andcommitted
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: 08a0063 ("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]>
1 parent 61c4378 commit 1fde0ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/sched/cls_flower.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,8 +2460,11 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
24602460
}
24612461

24622462
errout_idr:
2463-
if (!fold)
2463+
if (!fold) {
2464+
spin_lock(&tp->lock);
24642465
idr_remove(&head->handle_idr, fnew->handle);
2466+
spin_unlock(&tp->lock);
2467+
}
24652468
__fl_put(fnew);
24662469
errout_tb:
24672470
kfree(tb);

0 commit comments

Comments
 (0)