Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: hide the definition of dev_get_by_napi_id()

There are no module callers of dev_get_by_napi_id(),
and commit d1cacd747768 ("netdev: prevent accessing NAPI instances
from another namespace") proves that getting NAPI by id
needs to be done with care. So hide dev_get_by_napi_id().

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Link: https://patch.msgid.link/20250110004924.3212260-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+3 -3
-1
include/linux/netdevice.h
··· 3252 3252 struct net_device *netdev_get_by_name(struct net *net, const char *name, 3253 3253 netdevice_tracker *tracker, gfp_t gfp); 3254 3254 struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 3255 - struct net_device *dev_get_by_napi_id(unsigned int napi_id); 3256 3255 void netdev_copy_name(struct net_device *dev, char *name); 3257 3256 3258 3257 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
-2
net/core/dev.c
··· 957 957 * its reference counter increased so the caller must be careful 958 958 * about locking. The caller must hold RCU lock. 959 959 */ 960 - 961 960 struct net_device *dev_get_by_napi_id(unsigned int napi_id) 962 961 { 963 962 struct napi_struct *napi; ··· 970 971 971 972 return napi ? napi->dev : NULL; 972 973 } 973 - EXPORT_SYMBOL(dev_get_by_napi_id); 974 974 975 975 static DEFINE_SEQLOCK(netdev_rename_lock); 976 976
+1
net/core/dev.h
··· 23 23 extern int netdev_flow_limit_table_len; 24 24 25 25 struct napi_struct *netdev_napi_by_id(struct net *net, unsigned int napi_id); 26 + struct net_device *dev_get_by_napi_id(unsigned int napi_id); 26 27 27 28 #ifdef CONFIG_PROC_FS 28 29 int __init dev_proc_init(void);
+2
net/socket.c
··· 110 110 #include <linux/ptp_clock_kernel.h> 111 111 #include <trace/events/sock.h> 112 112 113 + #include "core/dev.h" 114 + 113 115 #ifdef CONFIG_NET_RX_BUSY_POLL 114 116 unsigned int sysctl_net_busy_read __read_mostly; 115 117 unsigned int sysctl_net_busy_poll __read_mostly;