Re: [PATCH] USB: cdc-acm: fix racy TIOCMIWAIT implementation

From: Oliver Neukum

Date: Mon Sep 07 2026 - 08:58:09 EST




On 07.09.26 13:38, Johan Hovold wrote:
On Mon, Sep 07, 2026 at 12:28:46PM +0200, Oliver Neukum wrote:


On 07.09.26 12:01, Johan Hovold wrote:
On Mon, Sep 07, 2026 at 11:50:41AM +0200, Oliver Neukum wrote:

Yes, but user space can call TIOCGICOUNT multiple times in sequence
_without_ calling TIOCMIWAIT in between.
In that case the counters have to increase if a line changes, don't they?
For that to happen you need to handle a status change in the completion
handler.

Yes, the completion handler needs to handle the status change (i.e.
compare new and previous status and increment the counters), but it
shouldn't update any old *icount* structure.

We could do that and it would indeed be simpler.

But it would change the semantics so that past status changes
no longer show up in TIOCMIWAIT. Is that really a good idea?

Regards
Oliver