mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-27 03:49:57 -04:00
dpll: rely on rcu for netdev_dpll_pin()
This fixes a possible UAF in if_nlmsg_size(),
which can run without RTNL.
Add rcu protection to "struct dpll_pin"
Move netdev_dpll_pin() from netdevice.h to dpll.h to
decrease name pollution.
Note: This looks possible to no longer acquire RTNL in
netdev_dpll_pin_assign() later in net-next.
v2: do not force rcu_read_lock() in rtnl_dpll_pin_size() (Jiri Pirko)
Fixes: 5f18426928 ("netdev: expose DPLL pin handle for netdevice")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20240223123208.3543319-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
0e67899abf
commit
0d60d8df6f
@@ -2469,7 +2469,7 @@ struct net_device {
|
||||
struct devlink_port *devlink_port;
|
||||
|
||||
#if IS_ENABLED(CONFIG_DPLL)
|
||||
struct dpll_pin *dpll_pin;
|
||||
struct dpll_pin __rcu *dpll_pin;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_PAGE_POOL)
|
||||
/** @page_pools: page pools created for this netdevice */
|
||||
@@ -4035,15 +4035,6 @@ bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b);
|
||||
void netdev_dpll_pin_set(struct net_device *dev, struct dpll_pin *dpll_pin);
|
||||
void netdev_dpll_pin_clear(struct net_device *dev);
|
||||
|
||||
static inline struct dpll_pin *netdev_dpll_pin(const struct net_device *dev)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_DPLL)
|
||||
return dev->dpll_pin;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again);
|
||||
struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
||||
struct netdev_queue *txq, int *ret);
|
||||
|
||||
Reference in New Issue
Block a user