From: Takashi Iwai <tiwai@suse.de>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Bin Yu <byu@xidian.edu.cn>,
Cheng Wen <wencheng@xidian.edu.cn>
Subject: Re: [PATCH] ALSA: usx2y: Initialize idle URBs before submitting streams
Date: Sat, 31 Oct 2026 16:42:32 +0100 [thread overview]
Message-ID: <878q3dswpj.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261028103158.22996-1-25031212351@stu.xidian.edu.cn>
On Wed, 28 Oct 2026 11:31:58 +0100,
YuanZhe Liu wrote:
>
> usb_stream_start() submits the first two capture and playback URBs and
> only afterwards assigns sk->idle_inurb, sk->idle_outurb,
> sk->completed_inurb and sk->completed_outurb to the remaining two URBs
> of each direction.
>
> A transfer can complete as soon as usb_submit_urb() has been called, so
> the completion handler i_capture_start() or i_playback_start() may run
> before those pointers are set. While the stream is still being
> synchronized (state below usb_stream_sync1), stream_start() then calls
> playback_prep_freqn(sk, sk->idle_outurb) with sk->idle_outurb still
> NULL, and the packet descriptors are written through that NULL pointer:
>
> Oops: general protection fault, probably for non-canonical address
> 0xdffffc0000000018: 0000 [#1] SMP KASAN
> KASAN: null-ptr-deref in range [0x00000000000000c0-0x00000000000000c7]
> RIP: 0010:playback_prep_freqn+0x11c/0x4a0 sound/usb/usx2y/usb_stream.c:33
> Call Trace:
> <IRQ>
> stream_start+0x5dc/0x8d0 sound/usb/usx2y/usb_stream.c:596
> i_capture_start+0x3da/0x710 sound/usb/usx2y/usb_stream.c:654
> __usb_hcd_giveback_urb+0x238/0x550 drivers/usb/core/hcd.c:1657
> usb_giveback_urb_bh+0x20b/0x530 drivers/usb/core/hcd.c:1691
> tasklet_hi_action+0xa/0x20 kernel/softirq.c:994
> handle_softirqs+0x16f/0x440 kernel/softirq.c:645
> </IRQ>
>
> The four URBs referenced by these pointers are allocated long before and
> do not depend on any transfer state, so assign them before the submit
> loop. Keeping the assignment inside the retry path also restores a
> well-defined URB rotation when the start frame mismatch handling kills
> and resubmits the streams.
>
> Fixes: 030a07e441296c372f946cd4065b5d831d8dc40c ("ALSA: Add USB US122L driver")
> Cc: stable@vger.kernel.org
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Applied now. Thanks.
Takashi
prev parent reply other threads:[~2026-10-31 15:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 10:31 YuanZhe Liu
2026-10-30 17:36 ` YuanZhe Liu
2026-10-31 15:42 ` Takashi Iwai [this message]
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=878q3dswpj.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=25031212351@stu.xidian.edu.cn \
--cc=byu@xidian.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=wencheng@xidian.edu.cn \
/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®