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

From: Oliver Neukum

Date: Fri May 29 2026 - 06:35:16 EST


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