diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a6bb64dccb88..f5c1058f565c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2216,6 +2216,12 @@ struct net *dev_net(const struct net_device *dev) return read_pnet(&dev->nd_net); } +static inline +struct net *dev_net_rcu(const struct net_device *dev) +{ + return read_pnet_rcu(&dev->nd_net); +} + static inline void dev_net_set(struct net_device *dev, struct net *net) { diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 6ce0ec2dd203..334286b57994 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -330,7 +330,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet) #endif } -static inline struct net *read_pnet_rcu(possible_net_t *pnet) +static inline struct net *read_pnet_rcu(const possible_net_t *pnet) { #ifdef CONFIG_NET_NS return rcu_dereference(pnet->net);