mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Gui-Dong Han <hanguidong02@gmail.com>, Oliver Neukum <oneukum@suse.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	robert.hodaszi@digi.com, kees@kernel.org,
	linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: Re: [BUG] usb: cdc-wdm: Missing barriers in ad-hoc lockless buffer
Date: Thu, 5 Mar 2026 13:44:31 +0100	[thread overview]
Message-ID: <678e1fc6-356d-426a-aec0-f0bf46c7d3af@suse.com> (raw)
In-Reply-To: <CALbr=Lb6Vir4+O-=8-iL7M8=Gqgm=VUp6s+XGVC75QixFaSmOA@mail.gmail.com>



On 05.03.26 13:28, Gui-Dong Han wrote:

> Specifically, wdm_read() accesses ->length and then ->flags, often
> without holding ->iuspin. Similarly, wdm_in_callback() involves
> multiple accesses to both.
> 
> I am indeed nervous about this pattern. Without barriers, changes to
> these associated fields made on one CPU might be observed in a
> completely different order on another CPU.

OK, I rechecked. And indeed it seems to me like setting WDM_OVERFLOW
and WDM_READ could be reordered with respect to each other in
wdm_in_callback() and that must not happen.
What do you think?

	Regards
		Oliver


  reply	other threads:[~2026-03-05 12:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  8:41 Gui-Dong Han
2026-03-04  9:15 ` Greg KH
2026-03-05 11:35 ` Oliver Neukum
2026-03-05 12:28   ` Gui-Dong Han
2026-03-05 12:44     ` Oliver Neukum [this message]
2026-03-05 13:26       ` Gui-Dong Han
2026-03-06  9:25         ` Oliver Neukum
2026-03-06 10:36           ` Gui-Dong Han

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=678e1fc6-356d-426a-aec0-f0bf46c7d3af@suse.com \
    --to=oneukum@suse.com \
    --cc=baijiaju1990@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanguidong02@gmail.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robert.hodaszi@digi.com \
    /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®