mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 22:34:33 +01:00
net_sched: acquire RTNL in tc_action_net_exit()
I forgot to acquire RTNL in tc_action_net_exit()
which leads that action ops->cleanup() is not always
called with RTNL. This usually is not a big deal because
this function is called after all netns refcnt are gone,
but given RTNL protects more than just actions, add it
for safety and consistency.
Also add an assertion to catch other potential bugs.
Fixes: ddf97ccdd7 ("net_sched: add network namespace support for tc actions")
Reported-by: Lucas Bates <[email protected]>
Tested-by: Lucas Bates <[email protected]>
Cc: Jamal Hadi Salim <[email protected]>
Cc: Jiri Pirko <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
1 parent
74784da82f
commit
a159d3c4b8
2 files changed
+4
No files matched your search
@@ -122,7 +122,9 @@ void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
|
||||
|
||||
static inline void tc_action_net_exit(struct tc_action_net *tn)
|
||||
{
|
||||
rtnl_lock();
|
||||
tcf_idrinfo_destroy(tn->ops, tn->idrinfo);
|
||||
rtnl_unlock();
|
||||
kfree(tn->idrinfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (p) {
|
||||
if (bind)
|
||||
p->tcfa_bindcnt--;
|
||||
|
||||
Reference in new issue
Block a user