Patchwork [net-next,v2] netpoll: add some missing __rcu marks in several places

login
register
mail settings
Submitter Eric Dumazet
Date Feb. 16, 2013, 4:10 a.m.
Message ID <1360987823.19353.42.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/220926/
State RFC
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Feb. 16, 2013, 4:10 a.m.
On Sat, 2013-02-16 at 11:16 +0800, Cong Wang wrote:

> The reason is we don't dereference ->npinfo pointer, we just check if it
> is NULL, so doesn't need to call rcu_dereference(). Or am I missing
> anything?

Yes you are missing that the right thing to do is to use
rcu_access_pointer()

Sparse errors should not be fixed using random RCU verbs,
please be more careful.




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Amerigo Wang - Feb. 16, 2013, 5:33 a.m.
On Fri, 2013-02-15 at 20:10 -0800, Eric Dumazet wrote:
> On Sat, 2013-02-16 at 11:16 +0800, Cong Wang wrote:
> 
> > The reason is we don't dereference ->npinfo pointer, we just check if it
> > is NULL, so doesn't need to call rcu_dereference(). Or am I missing
> > anything?
> 
> Yes you are missing that the right thing to do is to use
> rcu_access_pointer()
> 
> Sparse errors should not be fixed using random RCU verbs,
> please be more careful.

Ah, I wasn't aware of that API. Will send v3.

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 05c5efe..03e5949 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -950,7 +950,7 @@  static void team_port_disable_netpoll(struct team_port *port)
 
 static struct netpoll_info *team_netpoll_info(struct team *team)
 {
-	return team->dev->npinfo;
+	return rcu_access_pointer(team->dev->npinfo);
 }
 
 #else