Skip to content

Commit d4f84a4

Browse files
congwangdavem330
authored andcommitted
net_sched: use tcf_queue_work() in rsvp filter
Defer the tcf_exts_destroy() in RCU callback to tc filter workqueue and get RTNL lock. Reported-by: Chris Mi <chrism@mellanox.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Jiri Pirko <jiri@resnulli.us> Cc: John Fastabend <john.fastabend@gmail.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c2f3f31 commit d4f84a4

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

net/sched/cls_rsvp.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ struct rsvp_filter {
9797

9898
u32 handle;
9999
struct rsvp_session *sess;
100-
struct rcu_head rcu;
100+
union {
101+
struct work_struct work;
102+
struct rcu_head rcu;
103+
};
101104
};
102105

103106
static inline unsigned int hash_dst(__be32 *dst, u8 protocol, u8 tunnelid)
@@ -282,12 +285,22 @@ static int rsvp_init(struct tcf_proto *tp)
282285
return -ENOBUFS;
283286
}
284287

285-
static void rsvp_delete_filter_rcu(struct rcu_head *head)
288+
static void rsvp_delete_filter_work(struct work_struct *work)
286289
{
287-
struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu);
290+
struct rsvp_filter *f = container_of(work, struct rsvp_filter, work);
288291

292+
rtnl_lock();
289293
tcf_exts_destroy(&f->exts);
290294
kfree(f);
295+
rtnl_unlock();
296+
}
297+
298+
static void rsvp_delete_filter_rcu(struct rcu_head *head)
299+
{
300+
struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu);
301+
302+
INIT_WORK(&f->work, rsvp_delete_filter_work);
303+
tcf_queue_work(&f->work);
291304
}
292305

293306
static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f)

0 commit comments

Comments
 (0)