]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: hide the definition of dev_get_by_napi_id()
authorJakub Kicinski <kuba@kernel.org>
Fri, 10 Jan 2025 00:49:24 +0000 (16:49 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 11 Jan 2025 02:37:01 +0000 (18:37 -0800)
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>
include/linux/netdevice.h
net/core/dev.c
net/core/dev.h
net/socket.c

index 1812564b52047261bf5de8109ef5e69a96284d34..aeb4a6cff171820982321f912a07ac36d56fe77d 100644 (file)
@@ -3252,7 +3252,6 @@ struct net_device *netdev_get_by_index(struct net *net, int ifindex,
 struct net_device *netdev_get_by_name(struct net *net, const char *name,
                                      netdevice_tracker *tracker, gfp_t gfp);
 struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
-struct net_device *dev_get_by_napi_id(unsigned int napi_id);
 void netdev_copy_name(struct net_device *dev, char *name);
 
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
index 4452ca2c91ea6579fcefbe6a56e6becb02166531..1a90ed8cc6cc29452ea85973b6229210d184098a 100644 (file)
@@ -957,7 +957,6 @@ EXPORT_SYMBOL(netdev_get_by_index);
  *     its reference counter increased so the caller must be careful
  *     about locking. The caller must hold RCU lock.
  */
-
 struct net_device *dev_get_by_napi_id(unsigned int napi_id)
 {
        struct napi_struct *napi;
@@ -971,7 +970,6 @@ struct net_device *dev_get_by_napi_id(unsigned int napi_id)
 
        return napi ? napi->dev : NULL;
 }
-EXPORT_SYMBOL(dev_get_by_napi_id);
 
 static DEFINE_SEQLOCK(netdev_rename_lock);
 
index 08812a025a9b17420a66f27bf5650fced88563b7..d8966847794ceef0c2e6d5540d1e5dfa9efa5bac 100644 (file)
@@ -23,6 +23,7 @@ struct sd_flow_limit {
 extern int netdev_flow_limit_table_len;
 
 struct napi_struct *netdev_napi_by_id(struct net *net, unsigned int napi_id);
+struct net_device *dev_get_by_napi_id(unsigned int napi_id);
 
 #ifdef CONFIG_PROC_FS
 int __init dev_proc_init(void);
index 16402b8be5a7f3abeeac0f762e6846b00024a1a1..4afe31656a2b4def19803099f8879097ffe9817f 100644 (file)
 #include <linux/ptp_clock_kernel.h>
 #include <trace/events/sock.h>
 
+#include "core/dev.h"
+
 #ifdef CONFIG_NET_RX_BUSY_POLL
 unsigned int sysctl_net_busy_read __read_mostly;
 unsigned int sysctl_net_busy_poll __read_mostly;