Commit ff25276de997f41197ebab91935627c249a30fc4

Authored by Vlad Buslov
Committed by David S. Miller
1 parent 54d0d423a4

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>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

... ... @@ -288,6 +288,7 @@
288 288 * for foolproof you need to not assume this
289 289 */
290 290  
  291 + spin_lock_bh(&ipt->tcf_lock);
291 292 t = kmemdup(ipt->tcfi_t, ipt->tcfi_t->u.user.target_size, GFP_ATOMIC);
292 293 if (unlikely(!t))
293 294 goto nla_put_failure;
294 295  
... ... @@ -307,10 +308,12 @@
307 308 if (nla_put_64bit(skb, TCA_IPT_TM, sizeof(tm), &tm, TCA_IPT_PAD))
308 309 goto nla_put_failure;
309 310  
  311 + spin_unlock_bh(&ipt->tcf_lock);
310 312 kfree(t);
311 313 return skb->len;
312 314  
313 315 nla_put_failure:
  316 + spin_unlock_bh(&ipt->tcf_lock);
314 317 nlmsg_trim(skb, b);
315 318 kfree(t);
316 319 return -1;