linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: Fix suspicious RCU usage warning in ip6mr
@ 2020-05-14  7:02 madhuparnabhowmik10
  2020-05-14 16:40 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: madhuparnabhowmik10 @ 2020-05-14  7:02 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji, kuba
  Cc: netdev, linux-kernel, sfr, frextrite, joel, paulmck, cai,
	Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

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: d13fee049f ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage
Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
 net/ipv6/ip6mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 65a54d74acc1..fbe282bb8036 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -98,7 +98,7 @@ 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)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv6: Fix suspicious RCU usage warning in ip6mr
  2020-05-14  7:02 [PATCH net] ipv6: Fix suspicious RCU usage warning in ip6mr madhuparnabhowmik10
@ 2020-05-14 16:40 ` Jakub Kicinski
  2020-05-15 17:32   ` Madhuparna Bhowmik
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-05-14 16:40 UTC (permalink / raw)
  To: madhuparnabhowmik10
  Cc: davem, kuznet, yoshfuji, netdev, linux-kernel, sfr, frextrite,
	joel, paulmck, cai

On Thu, 14 May 2020 12:32:04 +0530 madhuparnabhowmik10@gmail.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> 
> 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: d13fee049f ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage

	Fixes tag: Fixes: d13fee049f ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage
	Has these problem(s):
		- Target SHA1 does not exist

I think the message at the end is confusing automation, could you use
the standard Fixes tag format, please?

> Reported-by: kernel test robot <lkp@intel.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> ---
>  net/ipv6/ip6mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
> index 65a54d74acc1..fbe282bb8036 100644
> --- a/net/ipv6/ip6mr.c
> +++ b/net/ipv6/ip6mr.c
> @@ -98,7 +98,7 @@ 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))

double space, line over 80 chars

>  static struct mr_table *ip6mr_mr_table_iter(struct net *net,
>  					    struct mr_table *mrt)

Other than these nits looks good, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv6: Fix suspicious RCU usage warning in ip6mr
  2020-05-14 16:40 ` Jakub Kicinski
@ 2020-05-15 17:32   ` Madhuparna Bhowmik
  0 siblings, 0 replies; 3+ messages in thread
From: Madhuparna Bhowmik @ 2020-05-15 17:32 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: madhuparnabhowmik10, davem, kuznet, yoshfuji, netdev,
	linux-kernel, sfr, frextrite, joel, paulmck, cai

On Thu, May 14, 2020 at 09:40:08AM -0700, Jakub Kicinski wrote:
> On Thu, 14 May 2020 12:32:04 +0530 madhuparnabhowmik10@gmail.com wrote:
> > From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> > 
> > 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: d13fee049f ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage
> 
> 	Fixes tag: Fixes: d13fee049f ("Default enable RCU list lockdep debugging with .."): WARNING: suspicious RCU usage
> 	Has these problem(s):
> 		- Target SHA1 does not exist
>
I got this report: https://lkml.org/lkml/2020/5/12/1358

That's why I used this SHA1 with the fixes tag.

> I think the message at the end is confusing automation, could you use
> the standard Fixes tag format, please?
>
Sure, I will do that.
> > Reported-by: kernel test robot <lkp@intel.com>
> > Suggested-by: Jakub Kicinski <kuba@kernel.org>
> > Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> > ---
> >  net/ipv6/ip6mr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
> > index 65a54d74acc1..fbe282bb8036 100644
> > --- a/net/ipv6/ip6mr.c
> > +++ b/net/ipv6/ip6mr.c
> > @@ -98,7 +98,7 @@ 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))
> 
> double space, line over 80 chars

Okay, I will make these changes and send the patch.

Regards,
Madhuparna
> 
> >  static struct mr_table *ip6mr_mr_table_iter(struct net *net,
> >  					    struct mr_table *mrt)
> 
> Other than these nits looks good, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-15 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  7:02 [PATCH net] ipv6: Fix suspicious RCU usage warning in ip6mr madhuparnabhowmik10
2020-05-14 16:40 ` Jakub Kicinski
2020-05-15 17:32   ` Madhuparna Bhowmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).