[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c35f98be-23a3-41c3-bee5-f394ce504545@suse.com>
Date: Mon, 15 Apr 2024 12:14:48 +0200
From: Oliver Neukum <oneukum@...e.com>
To: Bjørn Mork <bjorn@...k.no>,
Oliver Neukum <oneukum@...e.com>
Cc: Aleksander Morgado <aleksandermj@...omium.org>,
linux-usb@...r.kernel.org, gregkh@...uxfoundation.org, linux@...ck-us.net,
linux-kernel@...r.kernel.org, ejcaruso@...omium.org
Subject: Re: [PATCH] usb: cdc-wdm: close race between read and workqueue
On 15.04.24 11:26, Bjørn Mork wrote:
> Oliver Neukum <oneukum@...e.com> writes:
>> On 15.04.24 08:47, Bjørn Mork wrote:
>>
>>> urb from service_outstanding_interrupt(). That's why it was added. See
>>> the explanation Robert wrote when introducing it:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/usb/class/cdc-wdm.c?id=c1da59dad0ebd3f9bd238f3fff82b1f7ffda7829
>>
>> Well, the explanation is correct in that we must read
>> data available. However, if the RESPONDING flag is set
>> and the URB submitted, we are already doing so.
>
> Sounds reasonable. Except that the bug proves we didn't.
Why? I am afraid I do not get that part.
> If you are right that service_outstanding_interrupt can race againts
> itself (and I don't doubt that), then I guess this could also happen
> between failure to submit the URB and clearing the flag?
Yes, it can. In fact in this case the behavior should not change.
I am afraid we have a misunderstanding. It seems to me that in the
unchanged driver the result of service_outstanding_interrupt()
is undefined.
Please explain.
Regards
Oliver
Powered by blists - more mailing lists