]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ALSA: usb-audio: avoid kobject path lookup in DualSense match
authorDarvell Long <contact@darvell.me>
Wed, 24 Jun 2026 14:37:23 +0000 (07:37 -0700)
committerTakashi Iwai <tiwai@suse.de>
Thu, 25 Jun 2026 11:52:32 +0000 (13:52 +0200)
commit7693c0cc415f3a16a7a3355f245474a5e661be4e
treea8712b167deb2dbc21fbc26c0d9a0286963d11c3
parent00e44a68efef50f65b12854b41f098b4d50f10be
ALSA: usb-audio: avoid kobject path lookup in DualSense match

The DualSense jack-detection input handler verifies that a matching input
device belongs to the same physical controller by building kobject path
strings for both the input device and the USB audio device, then comparing
the path prefix.

This was observed when a weak physical connection caused the controller
to rapidly disconnect and reconnect. During that repeated hotplug,
snd_dualsense_ih_match() can run while the controller's USB device is
being disconnected. kobject_get_path() walks ancestor kobjects and
dereferences their names; if the USB device kobject name is no longer
valid, this can fault in strlen():

  RIP: 0010:strlen+0x10/0x30
  Call Trace:
   kobject_get_path+0x34/0x150
   snd_dualsense_ih_match+0x49/0xd0 [snd_usb_audio]
   input_register_device+0x566/0x6a0
   ps_probe+0xb89/0x1590 [hid_playstation]

The same ownership check can be done without building kobject path
strings. The input device is parented below the HID device, USB interface
and USB device, so walking the input device parent chain and comparing
against the mixer USB device preserves the check without dereferencing
kobject names during disconnect.

Fixes: 79d561c4ec04 ("ALSA: usb-audio: Add mixer quirk for Sony DualSense PS5")
Cc: <stable@vger.kernel.org>
Assisted-by: Cute:gpt-5.5
Signed-off-by: Darvell Long <contact@darvell.me>
Link: https://patch.msgid.link/20260624143723.2986353-1-contact@darvell.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer_quirks.c