From: Jiaming Zhang <r772577952@gmail.com>
To: tiwai@suse.de
Cc: g@b4.vu, linux-kernel@vger.kernel.org,
linux-sound@vger.kernel.org, perex@perex.cz,
r772577952@gmail.com, syzkaller@googlegroups.com, tiwai@suse.com
Subject: [PATCH] ALSA: FCP: Fix NULL pointer dereference in interface lookup
Date: Thu, 25 Jun 2026 21:49:33 +0800 [thread overview]
Message-ID: <20260625134933.425785-1-r772577952@gmail.com> (raw)
In-Reply-To: <87echuvo7x.wl-tiwai@suse.de>
A malformed USB device can provide a vendor-specific interface without
any endpoint descriptors. fcp_find_fc_interface() currently selects the
first vendor-specific interface and reads endpoint 0 from it, without
checking whether the interface actually has any endpoints.
When bNumEndpoints is zero, no endpoint array is allocated for the parsed
alternate setting, so get_endpoint(..., 0) yields an invalid endpoint
descriptor pointer. Dereferencing it through usb_endpoint_num() then
triggers a NULL pointer dereference.
Skip vendor-specific interfaces that do not have any endpoints.
Fixes: 46757a3e7d50 ("ALSA: FCP: Add Focusrite Control Protocol driver")
Reported-by: Jiaming Zhang <r772577952@gmail.com>
Closes: https://lore.kernel.org/lkml/CANypQFb1EHj0xX8bA1WxSOSK-5xca6ZNKzOQcp12=s=puY7VFw@mail.gmail.com/
Signed-off-by: Jiaming Zhang <r772577952@gmail.com>
---
sound/usb/fcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index ea746bdb36ff..6f5dcd35e1d4 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -1083,6 +1083,8 @@ static int fcp_find_fc_interface(struct usb_mixer_interface *mixer)
if (desc->bInterfaceClass != 255)
continue;
+ if (desc->bNumEndpoints < 1)
+ continue;
epd = get_endpoint(intf->altsetting, 0);
private->bInterfaceNumber = desc->bInterfaceNumber;
base-commit: ab9de95c9cf952332ab79453b4b5d1bfca8e514f
--
2.43.0
next prev parent reply other threads:[~2026-06-25 13:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 10:24 [Linux Kernel Bug] general protection fault in snd_fcp_init Jiaming Zhang
2026-06-25 11:44 ` Takashi Iwai
2026-06-25 13:49 ` Jiaming Zhang [this message]
2026-06-26 5:47 ` [PATCH] ALSA: FCP: Fix NULL pointer dereference in interface lookup Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625134933.425785-1-r772577952@gmail.com \
--to=r772577952@gmail.com \
--cc=g@b4.vu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=syzkaller@googlegroups.com \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®