lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 20 Mar 2024 07:05:42 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Breno Leitao <leitao@...ian.org>, Kalle Valo <kvalo@...nel.org>,
 Jeff Johnson <jjohnson@...nel.org>
Cc: kuba@...nel.org, keescook@...omium.org,
 "open list:NETWORKING DRIVERS (WIRELESS)" <linux-wireless@...r.kernel.org>,
 "open list:QUALCOMM ATHEROS ATH11K WIRELESS DRIVER"
 <ath11k@...ts.infradead.org>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] wifi: ath11k: allocate dummy net_device dynamically



On 3/19/2024 11:57 AM, Breno Leitao wrote:
> Embedding net_device into structures prohibits the usage of flexible
> arrays in the net_device structure. For more details, see the discussion
> at [1].
> 
> Un-embed the net_device from struct ath11k_ext_irq_grp by converting it
> into a pointer. Then use the leverage alloc_netdev() to allocate the
> net_device object at ath11k_ahb_config_ext_irq() for ahb, and
> ath11k_pcic_ext_irq_config() for pcic.
> 
>   The free of the device occurs at ath11k_ahb_free_ext_irq() for the ahb
> case, and ath11k_pcic_free_ext_irq() for the pcic case.
> 
> [1] https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/
> 
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
>   drivers/net/wireless/ath/ath11k/ahb.c  |  8 ++++++--
>   drivers/net/wireless/ath/ath11k/core.h |  2 +-
>   drivers/net/wireless/ath/ath11k/pcic.c | 21 +++++++++++++++++----
>   3 files changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c
> index 7c0a23517949..a8d89f510f62 100644
> --- a/drivers/net/wireless/ath/ath11k/ahb.c
> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
> @@ -442,6 +442,7 @@ static void ath11k_ahb_free_ext_irq(struct ath11k_base *ab)
>   			free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp);
>   
>   		netif_napi_del(&irq_grp->napi);
> +		free_netdev(irq_grp->napi_ndev);
>   	}
>   }
>   
> @@ -533,8 +534,11 @@ static int ath11k_ahb_config_ext_irq(struct ath11k_base *ab)
>   
>   		irq_grp->ab = ab;
>   		irq_grp->grp_id = i;
> -		init_dummy_netdev(&irq_grp->napi_ndev);
> -		netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi,
> +		irq_grp->napi_ndev = alloc_netdev(0, "dummy", NET_NAME_UNKNOWN,
> +						  init_dummy_netdev);

Is not this going to be a problem with multiple network device drivers 
loaded in a given system and all using "dummy" here? While 
NET_NAME_UNKNOWN ensures that this is not exposed to user-space, there 
is still this part of alloc_netdev_mqs() which is going to be non-unique:

         ref_tracker_dir_init(&dev->refcnt_tracker, 128, name);
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ