Skip to content

Commit

Permalink
net/sched: flower: Add lock protection when remove filter handle
Browse files Browse the repository at this point in the history
[ Upstream commit 1fde0ca ]

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 <jianbol@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20240220085928.9161-1-jianbol@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Jianbo Liu authored and gregkh committed Mar 1, 2024
1 parent 30d8d56 commit 88895d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sched/cls_flower.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 88895d4

Please sign in to comment.