net: hide the definition of dev_get_by_napi_id()
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 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().
---
CC: [email protected]
--- include/linux/netdevice.h | 1 - net/core/dev.c | 2 -- net/core/dev.h | 1 + net/socket.c | 2 ++ 4 files changed, 3 insertions(+), 3 deletions(-)
include/linux/netdevice.h +0 -1
@@ -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,
net/core/dev.c +0 -2
@@ -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);
net/core/dev.h +1 -0
@@ -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 );
net/socket.c +2 -0
@@ -110,6 +110,8 @@#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 ;
Signature · 1 line
2.47.1
Quoted 6 lines · Jakub Kicinski
There are no module callers of
dev_get_by_napi_id(), and commitd1cacd747768("netdev: prevent accessing NAPI instances from another namespace") proves that getting NAPI by id needs to be done with care. So hidedev_get_by_napi_id().Signed-off-by Jakub Kicinski <[email protected]>
Quoted 66 lines
---
CC: [email protected]--- include/linux/netdevice.h | 1 - net/core/dev.c | 2 -- net/core/dev.h | 1 + net/socket.c | 2 ++ 4 files changed, 3 insertions(+), 3 deletions(-)include/linux/netdevice.h +0
-1@@ -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,net/core/dev.c +0
-2@@ -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);net/core/dev.h +1
-0@@ -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 );net/socket.c +2
-0@@ -110,6 +110,8 @@#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 ;
Quoted 7 lines · Jakub Kicinski
There are no module callers of
dev_get_by_napi_id(), and commitd1cacd747768("netdev: prevent accessing NAPI instances from another namespace") proves that getting NAPI by id needs to be done with care. So hidedev_get_by_napi_id().Signed-off-by Jakub Kicinski <[email protected]>
Signature · 2 lines
Regards, Kalesh AP
Quoted 6 lines · Jakub Kicinski
There are no module callers of
dev_get_by_napi_id(), and commitd1cacd747768("netdev: prevent accessing NAPI instances from another namespace") proves that getting NAPI by id needs to be done with care. So hidedev_get_by_napi_id().Signed-off-by Jakub Kicinski <[email protected]>
Quoted 8 lines
---
CC: [email protected]--- include/linux/netdevice.h | 1 - net/core/dev.c | 2 -- net/core/dev.h | 1 + net/socket.c | 2 ++ 4 files changed, 3 insertions(+), 3 deletions(-)
Thanks.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 9 Jan 2025 16:49:24 -0800 you wrote:
There are no module callers of
dev_get_by_napi_id(), and commitd1cacd747768("netdev: prevent accessing NAPI instances from another namespace") proves that getting NAPI by id needs to be done with care. So hidedev_get_by_napi_id().Signed-off-by Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [net-next] net: hide the definition of dev_get_by_napi_id()
https://git.kernel.org/netdev/net-next/c/21520e74ba45
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html