Skip to content

Commit 4368586

Browse files
committed
net: hide the definition of dev_get_by_napi_id()
JIRA: https://issues.redhat.com/browse/RHEL-77816 Upstream Status: net.git commit 21520e7 commit 21520e7 Author: Jakub Kicinski <kuba@kernel.org> Date: Thu Jan 9 16:49:24 2025 -0800 net: hide the definition of dev_get_by_napi_id() There are no module callers of dev_get_by_napi_id(), and commit d1cacd7 ("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> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
1 parent 3698452 commit 4368586

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
lines changed

include/linux/netdevice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3278,7 +3278,6 @@ struct net_device *netdev_get_by_index(struct net *net, int ifindex,
32783278
struct net_device *netdev_get_by_name(struct net *net, const char *name,
32793279
netdevice_tracker *tracker, gfp_t gfp);
32803280
struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
3281-
struct net_device *dev_get_by_napi_id(unsigned int napi_id);
32823281
void netdev_copy_name(struct net_device *dev, char *name);
32833282

32843283
static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,

net/core/dev.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,6 @@ EXPORT_SYMBOL(netdev_get_by_index);
952952
* its reference counter increased so the caller must be careful
953953
* about locking. The caller must hold RCU lock.
954954
*/
955-
956955
struct net_device *dev_get_by_napi_id(unsigned int napi_id)
957956
{
958957
struct napi_struct *napi;
@@ -966,7 +965,6 @@ struct net_device *dev_get_by_napi_id(unsigned int napi_id)
966965

967966
return napi ? napi->dev : NULL;
968967
}
969-
EXPORT_SYMBOL(dev_get_by_napi_id);
970968

971969
static DEFINE_SEQLOCK(netdev_rename_lock);
972970

net/core/dev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct sd_flow_limit {
2525
extern int netdev_flow_limit_table_len;
2626

2727
struct napi_struct *netdev_napi_by_id(struct net *net, unsigned int napi_id);
28+
struct net_device *dev_get_by_napi_id(unsigned int napi_id);
2829

2930
#ifdef CONFIG_PROC_FS
3031
int __init dev_proc_init(void);

net/socket.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109
#include <linux/ptp_clock_kernel.h>
110110
#include <trace/events/sock.h>
111111

112+
#include "core/dev.h"
113+
112114
#ifdef CONFIG_NET_RX_BUSY_POLL
113115
unsigned int sysctl_net_busy_read __read_mostly;
114116
unsigned int sysctl_net_busy_poll __read_mostly;

0 commit comments

Comments
 (0)