mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
	Thomas Fourier <fourier.thomas@gmail.com>
Cc: stable@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	"open list:QUALCOMM ATHEROS ATH9K WIRELESS DRIVER"
	<linux-wireless@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] ath9k_htc: fix possibly missing barrier in ath9k_htc_rxep()
Date: Tue, 08 Sep 2026 18:43:42 +0200	[thread overview]
Message-ID: <87mrtrg0ch.fsf@toke.dk> (raw)
In-Reply-To: <a5534789-351d-402c-b7a0-bdd98b68fcd3@oss.qualcomm.com>

Jeff Johnson <jeff.johnson@oss.qualcomm.com> writes:

> On 8/3/2026 3:44 AM, Thomas Fourier wrote:
>> ath9k_rx_init() initialises the rx buffer and its lock then calls a
>> memory barrier and then sets the priv->rx.initialized flag. However,
>> ath9k_htc_rxep() reads that flag and imidiatly takes the lock. This may
>
> s/imidiatly/immediately/
>
>> cause the lock to be taken while not fully initialized.
>> 
>> Add a barrier to prevent speculative read of the lock before checking
>> the initized flag.
>
> s/initized/initialized/ (or initialised)
>
>> 
>> Fixes: b0ec7e55fce6 ("ath9k_htc: fix NULL pointer dereference at ath9k_htc_rxep()")
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
>> ---
>>  drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>> 
>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
>> index bed7ea2425a0..97d61f3f0aad 100644
>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
>> @@ -1145,6 +1145,12 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,
>>  	if (!data_race(priv->rx.initialized))
>>  		goto err;
>>  
>> +	/*
>> +	 * Make sure all the ath9k_rx_init() memory writes are visible before
>> +	 * proceeding.
>> +	 */
>> +	smp_rmb();
>> +
>>  	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
>>  	list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) {
>>  		if (!tmp_buf->in_process) {
>
> I decided to run this though my review agent, which has the following
> analysis:

[...]

> So my question: Are there any flaws with that analysis?

Well, my conclusion was basically that adding the smp_rmb() is not
actively wrong, even if it's not exactly idiomatic.

But sure, we can go with smp_store_release/load_acquire instead; might
as well fix up that other tasklet issue while I'm at it...

-Toke

      reply	other threads:[~2026-09-08 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 10:44 Thomas Fourier
2026-09-08  8:00 ` Toke Høiland-Jørgensen
2026-09-08 15:04 ` Jeff Johnson
2026-09-08 16:43   ` Toke Høiland-Jørgensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mrtrg0ch.fsf@toke.dk \
    --to=toke@toke.dk \
    --cc=fourier.thomas@gmail.com \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®