public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, Jay Vosburgh <j.vosburgh@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jonathan Toppins <jtoppins@redhat.com>,
	Paolo Abeni <pabeni@redhat.com>, liali <liali@redhat.com>
Subject: Re: [PATCH net 1/3] bonding: access curr_active_slave with rtnl_dereference
Date: Sat, 10 Dec 2022 20:28:20 +0800	[thread overview]
Message-ID: <Y5R7ZDfKkZKZe9j1@Laptop-X1> (raw)
In-Reply-To: <CANn89iK8TEtpZa67-FfR6KFKAj_HCdtn3573Z9Cd7PG26WP3iA@mail.gmail.com>

On Sat, Dec 10, 2022 at 12:58:59AM +0100, Eric Dumazet wrote:
> On Fri, Dec 9, 2022 at 11:13 AM Hangbin Liu <liuhangbin@gmail.com> wrote:
> >
> > Looks commit 4740d6382790 ("bonding: add proper __rcu annotation for
> > curr_active_slave") missed rtnl_dereference for curr_active_slave
> > in bond_miimon_commit().
> >
> > Fixes: 4740d6382790 ("bonding: add proper __rcu annotation for curr_active_slave")
> 
> 
> > Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> > ---
> >  drivers/net/bonding/bond_main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > index b9a882f182d2..2b6cc4dbb70e 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -2689,7 +2689,7 @@ static void bond_miimon_commit(struct bonding *bond)
> >
> >                         bond_miimon_link_change(bond, slave, BOND_LINK_UP);
> >
> > -                       if (!bond->curr_active_slave || slave == primary)
> > +                       if (!rtnl_dereference(bond->curr_active_slave) || slave == primary)
> 
> We do not dereference the pointer here.
> 
> If this is fixing a sparse issue, then use the correct RCU helper for this.
> 
> ( rcu_access_pointer())

Hmm... I saw in 4740d6382790 ("bonding: add proper __rcu annotation for
 curr_active_slave") there are also some dereference like that. Should I also
fix them at the same time? e.g.

@@ -2607,8 +2612,8 @@ static void bond_ab_arp_commit(struct bonding *bond)

                case BOND_LINK_UP:
                        trans_start = dev_trans_start(slave->dev);
-                       if (bond->curr_active_slave != slave ||
-                           (!bond->curr_active_slave &&
+                       if (rtnl_dereference(bond->curr_active_slave) != slave ||
+                           (!rtnl_dereference(bond->curr_active_slave) &&

Thanks
Hangbin

  reply	other threads:[~2022-12-10 12:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 10:13 [PATCH net 0/3] Bonding: fix high prio not effect issue Hangbin Liu
2022-12-09 10:13 ` [PATCH net 1/3] bonding: access curr_active_slave with rtnl_dereference Hangbin Liu
2022-12-09 23:46   ` Saeed Mahameed
2022-12-09 23:58   ` Eric Dumazet
2022-12-10 12:28     ` Hangbin Liu [this message]
2022-12-10 17:41       ` Eric Dumazet
2022-12-12  1:57         ` Hangbin Liu
2022-12-09 10:13 ` [PATCH net 2/3] bonding: do failover when high prio link up Hangbin Liu
2022-12-10  0:03   ` Saeed Mahameed
2022-12-10 12:23     ` Hangbin Liu
2022-12-09 10:13 ` [PATCH net 3/3] selftests: bonding: add bonding prio option test Hangbin Liu
2022-12-10  0:01 ` [PATCH net 0/3] Bonding: fix high prio not effect issue Jay Vosburgh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y5R7ZDfKkZKZe9j1@Laptop-X1 \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jtoppins@redhat.com \
    --cc=kuba@kernel.org \
    --cc=liali@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox