Skip to content

Commit

Permalink
net: sched: act_simple: remove dependency on rtnl lock
Browse files Browse the repository at this point in the history
Use tcf spinlock to protect private simple action data from concurrent
modification during dump. (simple init already uses tcf spinlock when
changing action state)

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vlad Buslov authored and David S. Miller committed Aug 11, 2018
1 parent d772849 commit 5e48180
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/sched/act_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,24 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
.index = d->tcf_index,
.refcnt = refcount_read(&d->tcf_refcnt) - ref,
.bindcnt = atomic_read(&d->tcf_bindcnt) - bind,
.action = d->tcf_action,
};
struct tcf_t t;

spin_lock_bh(&d->tcf_lock);
opt.action = d->tcf_action;
if (nla_put(skb, TCA_DEF_PARMS, sizeof(opt), &opt) ||
nla_put_string(skb, TCA_DEF_DATA, d->tcfd_defdata))
goto nla_put_failure;

tcf_tm_dump(&t, &d->tcf_tm);
if (nla_put_64bit(skb, TCA_DEF_TM, sizeof(t), &t, TCA_DEF_PAD))
goto nla_put_failure;
spin_unlock_bh(&d->tcf_lock);

return skb->len;

nla_put_failure:
spin_unlock_bh(&d->tcf_lock);
nlmsg_trim(skb, b);
return -1;
}
Expand Down

0 comments on commit 5e48180

Please sign in to comment.