From: Johan Hovold <johan@kernel.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] USB: cdc-acm: fix racy TIOCMIWAIT implementation
Date: Mon, 7 Sep 2026 12:01:20 +0200 [thread overview]
Message-ID: <ap6LcHWDvIWF3oNK@hovoldconsulting.com> (raw)
In-Reply-To: <72615ee3-46eb-4639-a408-ba29c1235d08@suse.com>
On Mon, Sep 07, 2026 at 11:50:41AM +0200, Oliver Neukum wrote:
> On 07.09.26 10:47, Johan Hovold wrote:
> > On Mon, Sep 07, 2026 at 10:17:38AM +0200, Oliver Neukum wrote:
> >> On 07.09.26 08:55, Johan Hovold wrote:
> >>> The wakeup condition needs to be checked after adding the task to the
> >>> waitqueue and updating the task state to avoid missing a racing modem
> >>> status update or disconnect.
> >>
> >> I am sorry, but in this case I have to ask:
> >> Isn't TIOCMIWAIT inherently racy against the hardware?
> >
> > What do you mean?
>
> The interface does not state from or to which state it changed.
> Now you could say that it is implicitly the last time TIOCMGET
> was called, but that is
>
> 1. not clearly stated
> 2. not enforceable
Right. The original implementation (and serial core) have always stored
the counters on entry and compared to that. So that is the defacto
semantics.
> > Looking at the implementation again now, it seems further changes are
> > needed to fix the implementation, though. The completion handler should
> > not be updating old_count. That's for each TIOCMIWAIT to do.
>
> I am sorry to be obnoxious about that, but I am afraid that would
> break TIOCGICOUNT
Why do you think so? TIOCGICOUNT just returns the current counters.
Johan
next prev parent reply other threads:[~2026-09-07 10:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 6:55 [PATCH] USB: cdc-acm: fix racy TIOCMIWAIT implementation Johan Hovold
2026-09-07 8:17 ` Oliver Neukum
2026-09-07 8:47 ` Johan Hovold
2026-09-07 9:13 ` Johan Hovold
2026-09-07 9:50 ` Oliver Neukum
2026-09-07 10:01 ` Johan Hovold [this message]
2026-09-07 10:28 ` Oliver Neukum
2026-09-07 11:38 ` Johan Hovold
2026-09-07 12:46 ` Oliver Neukum
2026-09-07 13:03 ` Johan Hovold
2026-09-08 6:54 ` Oliver Neukum
2026-09-08 7:12 ` Johan Hovold
2026-09-08 9:23 ` Oliver Neukum
2026-09-11 6:57 ` Johan Hovold
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=ap6LcHWDvIWF3oNK@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.