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] [day] [month] [year] [list]
Message-ID: <20250502093610.GE3339421@horms.kernel.org>
Date: Fri, 2 May 2025 10:36:10 +0100
From: Simon Horman <horms@...nel.org>
To: Brian Vazquez <brianvv@...gle.com>
Cc: Brian Vazquez <brianvv.kernel@...il.com>,
	Tony Nguyen <anthony.l.nguyen@...el.com>,
	Przemek Kitszel <przemyslaw.kitszel@...el.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	intel-wired-lan@...ts.osuosl.org,
	David Decotigny <decot@...gle.com>,
	Anjali Singhai <anjali.singhai@...el.com>,
	Sridhar Samudrala <sridhar.samudrala@...el.com>,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	emil.s.tantilov@...el.com, Josh Hay <joshua.a.hay@...el.com>,
	Luigi Rizzo <lrizzo@...gle.com>
Subject: Re: [iwl-net PATCH v2] idpf: fix a race in txq wakeup

On Thu, May 01, 2025 at 12:51:48PM -0400, Brian Vazquez wrote:
> On Thu, May 1, 2025 at 11:16 AM Simon Horman <horms@...nel.org> wrote:
> >
> > On Mon, Apr 28, 2025 at 07:55:32PM +0000, Brian Vazquez wrote:
> > > Add a helper function to correctly handle the lockless
> > > synchronization when the sender needs to block. The paradigm is
> > >
> > >         if (no_resources()) {
> > >                 stop_queue();
> > >                 barrier();
> > >                 if (!no_resources())
> > >                         restart_queue();
> > >         }
> > >
> > > netif_subqueue_maybe_stop already handles the paradigm correctly, but
> > > the code split the check for resources in three parts, the first one
> > > (descriptors) followed the protocol, but the other two (completions and
> > > tx_buf) were only doing the first part and so race prone.
> > >
> > > Luckily netif_subqueue_maybe_stop macro already allows you to use a
> > > function to evaluate the start/stop conditions so the fix only requires
> > > the right helper function to evaluate all the conditions at once.
> > >
> > > The patch removes idpf_tx_maybe_stop_common since it's no longer needed
> > > and instead adjusts separately the conditions for singleq and splitq.
> > >
> > > Note that idpf_rx_buf_hw_update doesn't need to check for resources
> > > since that will be covered in idpf_tx_splitq_frame.
> >
> > Should the above read idpf_tx_buf_hw_update() rather than
> > idpf_rx_buf_hw_update()?
> 
> Nice catch, that's a typo indeed.

Thanks. I only noticed because on reading the above I was looking
at idpf_rx_buf_hw_update(). Which turned out to not be very useful
in the context of reviewing this patch.

> > If so, I see that this is true when idpf_tx_buf_hw_update() is called from
> > idpf_tx_singleq_frame(). But is a check required in the case where
> > idpf_rx_buf_hw_update() is called by idpf_tx_singleq_map()?
> 
> No, the check is not required. The call is at the end of
> idpf_tx_singleq_map at that point you already checked for resources
> and you're about to send the pkt.

Thanks for the clarification.
In that case this patch looks good to me.
(But please do fix the typo.)

Reviewed-by: Simon Horman <horms@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ