Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net_sched: convert rsvp to call tcf_exts_destroy from rcu callback

Adjust destroy path of cls_rsvp to call tcf_exts_destroy() after
rcu grace period.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alexei Starovoitov and committed by
David S. Miller
9e528d89 ed7aa879

+14 -4
+14 -4
net/sched/cls_rsvp.h
··· 283 283 return -ENOBUFS; 284 284 } 285 285 286 - static void 287 - rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) 286 + static void rsvp_delete_filter_rcu(struct rcu_head *head) 287 + { 288 + struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu); 289 + 290 + tcf_exts_destroy(&f->exts); 291 + kfree(f); 292 + } 293 + 294 + static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) 288 295 { 289 296 tcf_unbind_filter(tp, &f->res); 290 - tcf_exts_destroy(&f->exts); 291 - kfree_rcu(f, rcu); 297 + /* all classifiers are required to call tcf_exts_destroy() after rcu 298 + * grace period, since converted-to-rcu actions are relying on that 299 + * in cleanup() callback 300 + */ 301 + call_rcu(&f->rcu, rsvp_delete_filter_rcu); 292 302 } 293 303 294 304 static bool rsvp_destroy(struct tcf_proto *tp, bool force)