From: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
To: mchehab@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [BUG] KASAN: slab-use-after-free in snd_usbtv_pcm_close
Date: Sun, 14 Jun 2026 21:34:02 -0400 [thread overview]
Message-ID: <178144969601.60470.4852887710381872458@gmail.com> (raw)
Hi Kernel Maintainers,
I hit the following report while testing current upstream kernel:
KASAN: slab-use-after-free in snd_usbtv_pcm_close
I reproduced this on commit: e8c2f9fdadee7cbc75134dc463c1e0d856d6e5c7 (May 25 2026)
The reproducer and .config files are here.
https://gist.github.com/shuangpengbai/d75fcb55c539aa707f95debbbc541511
I'm happy to test debug patches or provide additional information.
Reported-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
[ 143.650776][ T8284] ==================================================================
[ 143.653135][ T8284] BUG: KASAN: slab-use-after-free in snd_usbtv_pcm_close (include/linux/instrumented.h:82 include/linux/atomic/atomic-instrumented.h:32 drivers/media/usb/usbtv/usbtv-audio.c:80)
[ 143.655348][ T8284] Read of size 4 at addr ffff88816f8b0858 by task repro_usbtv_als/8284
[ 143.658360][ T8284] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 143.658373][ T8284] Call Trace:
[ 143.658401][ T8284] <TASK>
[ 143.658412][ T8284] dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
[ 143.658466][ T8284] print_report (mm/kasan/report.c:378 mm/kasan/report.c:482)
[ 143.658590][ T8284] kasan_report (mm/kasan/report.c:595)
[ 143.658627][ T8284] kasan_check_range (mm/kasan/generic.c:? mm/kasan/generic.c:200)
[ 143.658645][ T8284] snd_usbtv_pcm_close (include/linux/instrumented.h:82 include/linux/atomic/atomic-instrumented.h:32 drivers/media/usb/usbtv/usbtv-audio.c:80)
[ 143.658661][ T8284] snd_pcm_release_substream (sound/core/pcm_native.c:2777)
[ 143.658708][ T8284] snd_pcm_release (sound/core/pcm_native.c:2965)
[ 143.658720][ T8284] __fput (fs/file_table.c:510)
[ 143.658744][ T8284] fput_close_sync (fs/file_table.c:615)
[ 143.658797][ T8284] __x64_sys_close (fs/open.c:1507 fs/open.c:1492 fs/open.c:1492)
[ 143.658817][ T8284] do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
[ 143.658841][ T8284] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
[ 143.658929][ T8284] </TASK>
[ 143.675971][ T8284] Freed by task 10 on cpu 0 at 142.640459s:
[ 143.676382][ T8284] kasan_save_track (mm/kasan/common.c:57 mm/kasan/common.c:78)
[ 143.676713][ T8284] kasan_save_free_info (mm/kasan/generic.c:584)
[ 143.677057][ T8284] __kasan_slab_free (mm/kasan/common.c:253 mm/kasan/common.c:285)
[ 143.677388][ T8284] kfree (include/linux/kasan.h:235 mm/slub.c:2689 mm/slub.c:6251 mm/slub.c:6566)
[ 143.677659][ T8284] v4l2_device_put (drivers/media/v4l2-core/v4l2-device.c:51 include/linux/kref.h:65 drivers/media/v4l2-core/v4l2-device.c:56)
[ 143.677981][ T8284] usb_unbind_interface (drivers/usb/core/driver.c:458)
[ 143.678538][ T8284] device_release_driver_internal (drivers/base/dd.c:621 drivers/base/dd.c:1352 drivers/base/dd.c:1375)
[ 143.678995][ T8284] bus_remove_device (drivers/base/bus.c:657)
[ 143.679349][ T8284] device_del (drivers/base/core.c:3895)
[ 143.679650][ T8284] usb_disable_device (drivers/usb/core/message.c:1478)
[ 143.680005][ T8284] usb_disconnect (drivers/usb/core/hub.c:2315)
[ 143.680340][ T8284] hub_event (drivers/usb/core/hub.c:5407 drivers/usb/core/hub.c:5707 drivers/usb/core/hub.c:5871 drivers/usb/core/hub.c:5953)
Best,
Shuangpeng
next reply other threads:[~2026-06-15 1:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 1:34 Shuangpeng Bai [this message]
2026-07-06 20:24 ` [PATCH] media: usbtv: keep device alive while ALSA card exists Shuangpeng Bai
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=178144969601.60470.4852887710381872458@gmail.com \
--to=shuangpeng.kernel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.