From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+bfd77469c8966de076f7@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [sound?] [usb?] KASAN: slab-out-of-bounds Write in copy_to_urb
Date: Thu, 6 Nov 2025 10:10:38 +0800 [thread overview]
Message-ID: <20251106021039.8866-1-hdanton@sina.com> (raw)
In-Reply-To: <690b6b46.050a0220.3d0d33.0054.GAE@google.com>
> Date: Wed, 05 Nov 2025 07:20:38 -0800
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: ba36dd5ee6fd Merge tag 'bpf-fixes' of git://git.kernel.org..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1759afe2580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=929790bc044e87d7
> dashboard link: https://syzkaller.appspot.com/bug?extid=bfd77469c8966de076f7
> compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11c74292580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=107bffe2580000
#syz test
--- x/sound/usb/pcm.c
+++ y/sound/usb/pcm.c
@@ -1470,6 +1470,21 @@ static void fill_playback_urb_dsd_bitrev
urb_ctx_queue_advance(subs, urb, bytes);
}
+static int copy_to_urb_prepare(struct snd_usb_substream *subs, struct urb *urb,
+ int offset, int stride, unsigned int bytes)
+{
+ if (subs->hwptr_done + bytes > subs->buffer_bytes) {
+ ;
+ } else {
+ struct snd_urb_ctx *ctx = urb->context;
+
+ if (bytes > ctx->buffer_size ||
+ offset > ctx->buffer_size - bytes)
+ return -EAGAIN;
+ }
+ return 0;
+}
+
static void copy_to_urb(struct snd_usb_substream *subs, struct urb *urb,
int offset, int stride, unsigned int bytes)
{
@@ -1607,9 +1622,12 @@ static int prepare_playback_urb(struct s
fill_playback_urb_dsd_bitrev(subs, urb, bytes);
} else {
/* usual PCM */
- if (!subs->tx_length_quirk)
+ if (!subs->tx_length_quirk) {
+ int ret = copy_to_urb_prepare(subs, urb, 0, stride, bytes);
+ if (ret)
+ return ret;
copy_to_urb(subs, urb, 0, stride, bytes);
- else
+ } else
bytes = copy_to_urb_quirk(subs, urb, stride, bytes);
/* bytes is now amount of outgoing data */
}
--
next prev parent reply other threads:[~2025-11-06 2:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 15:20 syzbot
2025-11-06 2:10 ` Hillf Danton [this message]
2025-11-06 2:32 ` syzbot
2025-11-06 7:50 ` Forwarded: " syzbot
2025-11-06 8:33 ` [PATCH] ALSA: usb-audio: Prevent urb from writing out of bounds Lizhi Xu
2025-11-06 10:02 ` Takashi Iwai
2025-11-06 11:31 ` Lizhi Xu
2025-11-06 11:49 ` Takashi Iwai
2025-11-06 14:35 ` Lizhi Xu
2025-11-06 16:41 ` Takashi Iwai
2025-11-06 23:51 ` Hillf Danton
2025-11-07 0:12 ` [syzbot] [sound?] [usb?] KASAN: slab-out-of-bounds Write in copy_to_urb syzbot
2025-11-07 0:54 ` [PATCH] ALSA: usb-audio: Prevent urb from writing out of bounds Lizhi Xu
2025-11-07 1:13 ` Lizhi Xu
2025-11-08 7:54 ` Takashi Iwai
[not found] <20251106074957.2742443-1-lizhi.xu@windriver.com>
2025-11-06 8:11 ` [syzbot] [sound?] [usb?] KASAN: slab-out-of-bounds Write in copy_to_urb syzbot
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=20251106021039.8866-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+bfd77469c8966de076f7@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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®