From: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
To: dmitry.torokhov@gmail.com, mchehab@kernel.org,
linux-input@vger.kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [BUG] Input: rmi4: KASAN slab-use-after-free in v4l2_release
Date: Sun, 14 Jun 2026 21:45:18 -0400 [thread overview]
Message-ID: <178144969601.60470.13645789994911690209@gmail.com> (raw)
Hi input and media maintainers,
I hit the following report while testing current upstream kernel:
Input: rmi4: KASAN slab-use-after-free in v4l2_release
The issue was reproduced by holding an rmi4_f54 /dev/v4l-touch node open,
unbinding the rmi4_f54 function, and then closing the held fd.
I am not sure whether this is specific to rmi_f54 or a more generic V4L2
lifetime issue.
I reproduced this on commit: e8c2f9fdadee7cbc75134dc463c1e0d856d6e5c7 (May 25 2026)
To help trigger the bug more reliably, we applied a minimal diagnostic patch
that only adds delays and print statements.
The reproducer and .config files are here.
https://gist.github.com/shuangpengbai/351f125869016d5ce915cbc113abb547
I'm happy to test debug patches or provide additional information.
Reported-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
[ 87.788267][ T8430] BUG: KASAN: slab-use-after-free in v4l2_release (drivers/media/v4l2-core/v4l2-dev.c:466)
[ 87.790392][ T8430] Read of size 8 at addr ffff8881748dc588 by task rmi_f54_hold_cl/8430
[ 87.790944][ T8430]
[ 87.791114][ T8430] 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
[ 87.791116][ T8430] Call Trace:
[ 87.791119][ T8430] <TASK>
[ 87.791121][ T8430] dump_stack_lvl (lib/dump_stack.c:94 lib/dump_stack.c:120)
[ 87.791125][ T8430] print_report (mm/kasan/report.c:378 mm/kasan/report.c:482)
[ 87.791137][ T8430] kasan_report (mm/kasan/report.c:595)
[ 87.791143][ T8430] v4l2_release (drivers/media/v4l2-core/v4l2-dev.c:466)
[ 87.791146][ T8430] __fput (fs/file_table.c:510)
[ 87.791150][ T8430] fput_close_sync (fs/file_table.c:615)
[ 87.791695][ T8430] __x64_sys_close (fs/open.c:1507 fs/open.c:1492 fs/open.c:1492)
[ 87.791698][ T8430] do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
[ 87.791701][ T8430] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
[ 87.791704][ T8430] RIP: 0033:0x7fe62d972c03
[ 87.791708][ T8430] Code: e9 37 ff ff ff e8 2d f9 01 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8
[ 87.791710][ T8430] RSP: 002b:00007ffdc1dc6588 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
[ 87.791715][ T8430] RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007fe62d972c03
[ 87.791717][ T8430] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
[ 87.791718][ T8430] RBP: 0000000000000003 R08: 0000000000000000 R09: 00007fe62da160c0
[ 87.791720][ T8430] R10: fffffffffffffc0d R11: 0000000000000246 R12: 0000000000000004
[ 87.791722][ T8430] R13: 00007ffdc1dc66d0 R14: 00007ffdc1dc65d0 R15: 0000000000000000
[ 87.791725][ T8430] </TASK>
[ 87.791727][ T8430]
[ 87.803468][ T8430] Freed by task 8430 on cpu 1 at 87.787459s:
[ 87.803881][ T8430] kasan_save_track (mm/kasan/common.c:57 mm/kasan/common.c:78)
[ 87.804205][ T8430] kasan_save_free_info (mm/kasan/generic.c:584)
[ 87.804556][ T8430] __kasan_slab_free (mm/kasan/common.c:253 mm/kasan/common.c:285)
[ 87.804885][ T8430] kfree (include/linux/kasan.h:235 mm/slub.c:2689 mm/slub.c:6251 mm/slub.c:6566)
[ 87.805157][ T8430] devres_release_all (drivers/base/devres.c:50 drivers/base/devres.c:547 drivers/base/devres.c:576)
[ 87.805504][ T8430] device_release_driver_internal (drivers/base/dd.c:598 drivers/base/dd.c:1357 drivers/base/dd.c:1375)
[ 87.805929][ T8430] unbind_store (drivers/base/bus.c:244)
[ 87.806246][ T8430] kernfs_fop_write_iter (fs/kernfs/file.c:352)
[ 87.806616][ T8430] vfs_write (fs/read_write.c:595 fs/read_write.c:688)
[ 87.806914][ T8430] ksys_write (fs/read_write.c:740)
[ 87.807214][ T8430] do_syscall_64 (arch/x86/entry/syscall_64.c:63 arch/x86/entry/syscall_64.c:94)
[ 87.807542][ T8430] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
[ 87.807955][ T8430]
[ 87.808124][ T8430] The buggy address belongs to the object at ffff8881748dc000
[ 87.808124][ T8430] which belongs to the cache kmalloc-4k of size 4096
[ 87.809083][ T8430] The buggy address is located 1416 bytes inside of
[ 87.809083][ T8430] freed 4096-byte region [ffff8881748dc000, ffff8881748dd000)
[ 87.810030][ T8430]
Best,
Shuangpeng
reply other threads:[~2026-06-15 1:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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.13645789994911690209@gmail.com \
--to=shuangpeng.kernel@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox