Skip to content

Commit

Permalink
ipv6: Fix suspicious RCU usage warning in ip6mr
Browse files Browse the repository at this point in the history
This patch fixes the following warning:

=============================
WARNING: suspicious RCU usage
5.7.0-rc4-next-20200507-syzkaller #0 Not tainted
-----------------------------
net/ipv6/ip6mr.c:124 RCU-list traversed in non-reader section!!

ipmr_new_table() returns an existing table, but there is no table at
init. Therefore the condition: either holding rtnl or the list is empty
is used.

Fixes: d1db275 ("ipv6: ip6mr: support multiple tables")
Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Madhuparna Bhowmik authored and davem330 committed May 16, 2020
1 parent f85c159 commit b6dd5ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ static void ipmr_expire_process(struct timer_list *t);
#ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
#define ip6mr_for_each_table(mrt, net) \
list_for_each_entry_rcu(mrt, &net->ipv6.mr6_tables, list, \
lockdep_rtnl_is_held())
lockdep_rtnl_is_held() || \
list_empty(&net->ipv6.mr6_tables))

static struct mr_table *ip6mr_mr_table_iter(struct net *net,
struct mr_table *mrt)
Expand Down

0 comments on commit b6dd5ac

Please sign in to comment.