net_sched: check error pointer in tcf_dump_walker()
Subsystems (3)
PATCH 1/1 net_sched: check error pointer in tcf_dump_walker()
Although we take RTNL on dump path, it is possible to skip RTNL on insertion path. So the following race condition is possible:
rtnl_lock() // no rtnl lock
mutex_lock(&idrinfo->lock); // insert ERR_PTR(-EBUSY) mutex_unlock(&idrinfo->lock);
tc_dump_action()rtnl_unlock()
So we have to skip those temporary -EBUSY entries on dump path too.
Reported-and-tested-by [email protected]
Fixes 0fedc63fadf0 ("net_sched: commit action insertions together")
Cc Vlad Buslov <[email protected]>
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>
Signed-off-by Cong Wang <[email protected]>
--- net/sched/act_api.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/act_api.c +2 -0
@@ -235,6 +235,8 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb, index++;if (index < s_i)continue ; +if (IS_ERR (p)) +continue ;if (jiffy_since && time_after(jiffy_since,
Signature · 1 line
2.28.0
David Miller
maintainerFrom: Cong Wang <[email protected]>
Date: Fri, 2 Oct 2020 12:13:34 -0700
Quoted 14 lines
Although we take RTNL on dump path, it is possible to skip RTNL on insertion path. So the following race condition is possible:
rtnl_lock()// no rtnl lockmutex_lock(&idrinfo->lock); // insert ERR_PTR(-EBUSY) mutex_unlock(&idrinfo->lock);
tc_dump_action()rtnl_unlock()So we have to skip those temporary
-EBUSYentries on dump path too.
Quoted 6 lines
Reported-and-tested-by [email protected]Fixes 0fedc63fadf0 ("net_sched: commit action insertions together")Cc Vlad Buslov <[email protected]>Cc Jamal Hadi Salim <[email protected]>Cc Jiri Pirko <[email protected]>Signed-off-by Cong Wang <[email protected]>
Applied and queued up for -stable.