netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ipvlan: properly annotate rx_handler access
@ 2018-03-08  9:29 Paolo Abeni
  2018-03-08 16:12 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Abeni @ 2018-03-08  9:29 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Mahesh Bandewar, Jiri Benc

The rx_handler field is rcu-protected, but I forgot to use the
proper accessor while refactoring netif_is_ipvlan_port(). Such
function only check the rx_handler value, so it is safe, but we need
to properly read rx_handler via rcu_access_pointer() to avoid sparse
warnings.

Fixes: 1ec54cb44e67 ("net: unpollute priv_flags space")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 drivers/net/ipvlan/ipvlan.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h
index c818b9bdab6e..adb826f55e60 100644
--- a/drivers/net/ipvlan/ipvlan.h
+++ b/drivers/net/ipvlan/ipvlan.h
@@ -180,7 +180,7 @@ int ipvlan_link_register(struct rtnl_link_ops *ops);
 
 static inline bool netif_is_ipvlan_port(const struct net_device *dev)
 {
-	return dev->rx_handler == ipvlan_handle_frame;
+	return rcu_access_pointer(dev->rx_handler) == ipvlan_handle_frame;
 }
 
 #endif /* __IPVLAN_H */
-- 
2.14.3

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

* Re: [PATCH net-next] ipvlan: properly annotate rx_handler access
  2018-03-08  9:29 [PATCH net-next] ipvlan: properly annotate rx_handler access Paolo Abeni
@ 2018-03-08 16:12 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-03-08 16:12 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, maheshb, jbenc

From: Paolo Abeni <pabeni@redhat.com>
Date: Thu,  8 Mar 2018 10:29:30 +0100

> The rx_handler field is rcu-protected, but I forgot to use the
> proper accessor while refactoring netif_is_ipvlan_port(). Such
> function only check the rx_handler value, so it is safe, but we need
> to properly read rx_handler via rcu_access_pointer() to avoid sparse
> warnings.
> 
> Fixes: 1ec54cb44e67 ("net: unpollute priv_flags space")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied.

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

end of thread, other threads:[~2018-03-08 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08  9:29 [PATCH net-next] ipvlan: properly annotate rx_handler access Paolo Abeni
2018-03-08 16:12 ` David Miller

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).