Skip to content

Commit 21520e7

Browse files
committed
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 <[email protected]> Reviewed-by: Kalesh AP <[email protected]> Reviewed-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent af3525d commit 21520e7

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
@@ -3252,7 +3252,6 @@ struct net_device *netdev_get_by_index(struct net *net, int ifindex,
32523252
struct net_device *netdev_get_by_name(struct net *net, const char *name,
32533253
netdevice_tracker *tracker, gfp_t gfp);
32543254
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);
32563255
void netdev_copy_name(struct net_device *dev, char *name);
32573256

32583257
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
@@ -957,7 +957,6 @@ EXPORT_SYMBOL(netdev_get_by_index);
957957
* its reference counter increased so the caller must be careful
958958
* about locking. The caller must hold RCU lock.
959959
*/
960-
961960
struct net_device *dev_get_by_napi_id(unsigned int napi_id)
962961
{
963962
struct napi_struct *napi;
@@ -971,7 +970,6 @@ struct net_device *dev_get_by_napi_id(unsigned int napi_id)
971970

972971
return napi ? napi->dev : NULL;
973972
}
974-
EXPORT_SYMBOL(dev_get_by_napi_id);
975973

976974
static DEFINE_SEQLOCK(netdev_rename_lock);
977975

net/core/dev.h

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

2525
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);
2627

2728
#ifdef CONFIG_PROC_FS
2829
int __init dev_proc_init(void);

net/socket.c

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

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

0 commit comments

Comments
 (0)