Re: [PATCH v5] usb: usbfs: Require claiming a hub interface for hub class requests
From: YuanZhe Liu
Date: Tue Nov 10 2026 - 23:33:07 EST
Hi Michal,
> Does this really belong in devio.c?
>
> If anyone thinks that the trivial "bDeviceClass == USB_CLASS_HUB" isn't
> enough (Alan seemed to believe that it is, but hub_id_table has matches
> for interface class too), then perhaps this should be placed in hub.c
> near the ID table, so that it's more likely to be kept in sync?
> Seems overly specific to this case. It isn't safe in general: it could
> confuse the hub driver itself, disrupt functioning of child devices and
> their drivers, or break HCDs relying on core serializing any actions.
Both fair.
I'll fix the comment. The general reason for the check is that OUT
requests change state the hub driver owns: they can confuse the hub
driver, disrupt the devices behind the ports and their drivers, or
break an HCD that expects the core to serialize; the suspend/release
race is one way that goes wrong, not the reason for the check.
On placement, the simplest answer may be to drop the interface class
test altogether. Alan already said it is more than is needed, and the
spec does not allow a hub to be a composite device, so bDeviceClass is
enough and there is no helper left to place. I kept the interface
match only because hub_id_table has one. If you would rather keep it
for hubs that declare the class at the interface level, then hub.c next
to hub_id_table is the right home and I will move it there.
YuanZhe