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]
Message-ID: <32917bbb-c27a-4a65-8ba6-1df5c4729c12@gmail.com>
Date: Tue, 1 Apr 2025 12:37:34 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
 andrew+netdev@...n.ch, horms@...nel.org, ap420073@...il.com,
 almasrymina@...gle.com, dw@...idwei.uk, sdf@...ichev.me
Subject: Re: [PATCH net 1/2] net: move mp dev config validation to
 __net_mp_open_rxq()

On 3/31/25 20:43, Jakub Kicinski wrote:
> devmem code performs a number of safety checks to avoid having
> to reimplement all of them in the drivers. Move those to
> __net_mp_open_rxq() and reuse that function for binding to make
> sure that io_uring ZC also benefits from them.
> 
> While at it rename the queue ID variable to rxq_idx in
> __net_mp_open_rxq(), we touch most of the relevant lines.

Looks good, one question below

...
> diff --git a/net/core/devmem.c b/net/core/devmem.c
> index ee145a2aa41c..f2ce3c2ebc97 100644
> --- a/net/core/devmem.c
> +++ b/net/core/devmem.c
> @@ -8,7 +8,6 @@
...
> -
> -	err = xa_alloc(&binding->bound_rxqs, &xa_idx, rxq, xa_limit_32b,
> -		       GFP_KERNEL);
> +	err = __net_mp_open_rxq(dev, rxq_idx, &mp_params, extack);
>   	if (err)
>   		return err;

Was reversing the order b/w open and xa_alloc intentional?
It didn't need __net_mp_close_rxq() before, which is a good thing
considering the error handling in __net_mp_close_rxq is a bit
flaky (i.e. the WARN_ON at the end).

>   
> -	rxq->mp_params.mp_priv = binding;
> -	rxq->mp_params.mp_ops = &dmabuf_devmem_ops;
> -
> -	err = netdev_rx_queue_restart(dev, rxq_idx);
> +	rxq = __netif_get_rx_queue(dev, rxq_idx);
> +	err = xa_alloc(&binding->bound_rxqs, &xa_idx, rxq, xa_limit_32b,
> +		       GFP_KERNEL);
>   	if (err)
> -		goto err_xa_erase;
> +		goto err_close_rxq;
>   
>   	return 0;
>   
> -err_xa_erase:
> -	rxq->mp_params.mp_priv = NULL;
> -	rxq->mp_params.mp_ops = NULL;
> -	xa_erase(&binding->bound_rxqs, xa_idx);
> -
> +err_close_rxq:
> +	__net_mp_close_rxq(dev, rxq_idx, &mp_params);
>   	return err;
>   }

-- 
Pavel Begunkov


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ