Re: [PATCH] USB: cdc-acm: fix racy TIOCMIWAIT implementation
From: Oliver Neukum
Date: Mon Sep 07 2026 - 06:31:19 EST
On 07.09.26 12:01, Johan Hovold wrote:
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:
[..]
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.
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.
Regards
Oliver