Skip to content

Commit ff25276

Browse files
w1ldptrdavem330
authored andcommitted
net: sched: act_ipt: remove dependency on rtnl lock
Use tcf spinlock to protect ipt action private data from concurrent modification during dump. Ipt init already takes tcf spinlock when modifying ipt state. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 54d0d42 commit ff25276

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sched/act_ipt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind,
288288
* for foolproof you need to not assume this
289289
*/
290290

291+
spin_lock_bh(&ipt->tcf_lock);
291292
t = kmemdup(ipt->tcfi_t, ipt->tcfi_t->u.user.target_size, GFP_ATOMIC);
292293
if (unlikely(!t))
293294
goto nla_put_failure;
@@ -307,10 +308,12 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind,
307308
if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD))
308309
goto nla_put_failure;
309310

311+
spin_unlock_bh(&ipt->tcf_lock);
310312
kfree(t);
311313
return skb->len;
312314

313315
nla_put_failure:
316+
spin_unlock_bh(&ipt->tcf_lock);
314317
nlmsg_trim(skb, b);
315318
kfree(t);
316319
return -1;

0 commit comments

Comments
 (0)