Re: [PATCH v3] ALSA: usb-audio: validate full match when resolving quirk aliases

From: Takashi Iwai

Date: Wed Mar 18 2026 - 12:46:41 EST


On Wed, 18 Mar 2026 15:08:46 +0100,
Cássio Gabriel wrote:
>
> get_alias_quirk() resolves a quirk for an aliased USB ID by scanning
> usb_audio_ids[], but it currently checks only the vendor/product pair.
>
> This is weak for quirk table entries that also depend on additional
> USB_DEVICE_ID match fields, such as device or interface class,
> subclass, protocol, interface number, or bcdDevice range.
>
> Keep the aliased vid:pid as the lookup key, then validate only the
> remaining match criteria of each candidate entry against the real
> device/interface descriptors by clearing USB_DEVICE_ID_MATCH_DEVICE
> from a temporary copy and passing it to usb_match_one_id().
>
> Suggested-by: Takashi Iwai <tiwai@xxxxxxx>
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@xxxxxxxxx>
> ---
> Changes in v3:
> - rework alias quirk matching as suggested by Takashi Iwai
> - drop the explicit per-field helper
> - keep the aliased vid:pid check first
> - clear USB_DEVICE_ID_MATCH_DEVICE from a temporary id copy
> - Link to v2: https://lore.kernel.org/r/20260317-alsa-usb-fix-quirk-alias-v2-1-6e531c67f0c8@xxxxxxxxx
>
> Changes in v2:
> - drop the temporary usb_device_id reconstruction approach
> - validate only the remaining match_flags explicitly
> - pass struct usb_interface * to get_alias_quirk()
> - Link to v1: https://lore.kernel.org/r/20260314-alsa-usb-fix-quirk-alias-v1-1-3269998f7ada@xxxxxxxxx

Applied to for-next branch now. Thanks.


Takashi