net/sched: flower: Add lock protection when remove filter handle
Subsystems (3)
PATCH 1/1 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.
--- net/sched/cls_flower.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/cls_flower.c +4 -1
@@ -2460,8 +2460,11 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, } 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);
Signature · 1 line
2.26.2
Quoted 7 lines · Tue, Feb 20, 2024 at 09:59:28AM CET, [email protected] wrote:
As IDR can't protect itself from the concurrent modification, place
idr_remove()under the protection oftp->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]>
Quoted 11 lines · Jiri Pirko
Quoted 7 lines · Tue, Feb 20, 2024 at 09:59:28AM CET, [email protected] wrote:
As IDR can't protect itself from the concurrent modification, place
idr_remove()under the protection oftp->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]>
Jianbo, do you have a new test case that caught this that we can use? Just curious why it hasnt been caught earlier (it's been there for about a year).
cheers,
jamal
Quoted 13 lines · Jamal Hadi Salim
Quoted 12 lines · Jiri Pirko
Quoted 9 lines · Tue, Feb 20, 2024 at 09:59:28AM CET, [email protected] wrote:
As IDR can't protect itself from the concurrent modification, place
idr_remove()under the protection oftp->lock.Fixes 08a0063df3ae ("net/sched: flower: Move filter handleinitialization earlier")
Signed-off-by Jianbo Liu <[email protected]>Reviewed-by Cosmin Ratiu <[email protected]>Reviewed-by Gal Pressman <[email protected]>
Quoted 8 lines
Quoted 1 line
Reviewed-by Jiri Pirko <[email protected]>Acked-by Jamal Hadi Salim <[email protected]>Jianbo, do you have a new test case that caught this that we can use?
Just curious why it hasnt been caught earlier (it's been there for about a year).
I don't have the test case, sorry.
The issue was caught when we stressed performance on BlueField-3.
Thanks!
Jianbo
Quoted 3 lines
cheers,
jamal
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 20 Feb 2024 08:59:28 +0000 you wrote:
As IDR can't protect itself from the concurrent modification, place
idr_remove()under the protection oftp->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]>[...]
Here is the summary with links:
- [net] net/sched: flower: Add lock protection when remove filter handle
https://git.kernel.org/netdev/net/c/1fde0ca3a0de
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html