Re: [PATCH] usb: misc: yurex: fix ordering of usb_deregister_dev() and usb_set_intfdata()

From: Ginger

Date: Fri May 29 2026 - 09:58:26 EST


On Fri, May 29, 2026 at 6:31 PM Oliver Neukum <oneukum@xxxxxxxx> wrote:
>
> On 29.05.26 08:58, Ginger wrote:
>
> > I think the intuition is that the global exposure (i.e., the
> > 'usb_minors') of usb fops should be disabled first, so that the
> > subsequent nullification of internal fields can be considered local to
> > prevent concurrent accesses.
>
> Hi,
>
> if I understand the logic correctly, the order in yurex_disconnect()
> makes sure if yurex_open() and yurex_disconnect() race, yurex_open()
> will never see an unregistered device with intfdata != NULL.
> That is, precisely because without a lock the race is unavoidable
> the newly opening task will be guaranteed to know that it has
> lost the race.
>
> Regards
> Oliver
>

Hi,

Yes, I believe we are on the same page about this patch.

Regards,
Junzhe