Skip to content

Commit

Permalink
net_sched: check error pointer in tcf_dump_walker()
Browse files Browse the repository at this point in the history
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: 0fedc63 ("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]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
congwang authored and davem330 committed Oct 4, 2020
1 parent 9a9e774 commit 580e427
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/sched/act_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 580e427

Please sign in to comment.