In the Linux kernel, the following vulnerability has been resolved:
media: i2c: tc358743: Fix use-after-free bugs caused by orphan timer in probe
The state->timer is a cyclic timer that schedules worki2cpoll and delayedworkenablehotplug, while rearming itself. Using timerdelete() fails to guarantee the timer isn't still running when destroyed, similarly canceldelayedwork() cannot ensure delayedworkenablehotplug has terminated if already executing. During probe failure after timer initialization, these may continue running as orphans and reference the already-freed tc358743state object through tc358743irqpoll_timer.
The following is the trace captured by KASAN.
BUG: KASAN: slab-use-after-free in runtimerbase.part.0+0x7d7/0x8c0 Write of size 8 at addr ffff88800ded83c8 by task swapper/1/0 ... Call Trace: <IRQ> dumpstacklvl+0x55/0x70 printreport+0xcf/0x610 ? _pfxschedbalancefindsrcgroup+0x10/0x10 ? _runtimerbase.part.0+0x7d7/0x8c0 kasanreport+0xb8/0xf0 ? _runtimerbase.part.0+0x7d7/0x8c0 _runtimerbase.part.0+0x7d7/0x8c0 ? rcuschedclockirq+0xb06/0x27d0 ? _pfxruntimerbase.part.0+0x10/0x10 ? trytowakeup+0xb15/0x1960 ? tmigrupdateevents+0x280/0x740 ? _rawspinlockirq+0x80/0xe0 ? pfxrawspinlockirq+0x10/0x10 tmigrhandleremoteup+0x603/0x7e0 ? pfxtmigrhandleremoteup+0x10/0x10 ? schedbalancetrigger+0x98/0x9f0 ? schedtick+0x221/0x5a0 ? _rawspinlockirq+0x80/0xe0 ? _pfxrawspinlockirq+0x10/0x10 ? ticknohzhandler+0x339/0x440 ? _pfxtmigrhandleremoteup+0x10/0x10 _walkgroups.isra.0+0x42/0x150 tmigrhandleremote+0x1f4/0x2e0 ? _pfxtmigrhandleremote+0x10/0x10 ? ktimeget+0x60/0x140 ? lapicnextevent+0x11/0x20 ? clockeventsprogramevent+0x1d4/0x2a0 ? hrtimerinterrupt+0x322/0x780 handlesoftirqs+0x16a/0x550 irqexitrcu+0xaf/0xe0 sysvecapictimer_interrupt+0x70/0x80 </IRQ> ...
Allocated by task 141: kasansavestack+0x24/0x50 kasansavetrack+0x14/0x30 _kasankmalloc+0x7f/0x90 _kmallocnodetrackcallernoprof+0x198/0x430 devmkmalloc+0x7b/0x1e0 tc358743probe+0xb7/0x610 i2cdeviceprobe+0x51d/0x880 reallyprobe+0x1ca/0x5c0 _driverprobedevice+0x248/0x310 driverprobedevice+0x44/0x120 _deviceattachdriver+0x174/0x220 busforeachdrv+0x100/0x190 _deviceattach+0x206/0x370 busprobedevice+0x123/0x170 deviceadd+0xd25/0x1470 i2cnewclientdevice+0x7a0/0xcd0 dooneinitcall+0x89/0x300 doinitmodule+0x29d/0x7f0 loadmodule+0x4f48/0x69e0 initmodulefromfile+0xe4/0x150 idempotentinitmodule+0x320/0x670 _x64sysfinitmodule+0xbd/0x120 dosyscall64+0xac/0x280 entrySYSCALL64after_hwframe+0x77/0x7f
Freed by task 141: kasansavestack+0x24/0x50 kasansavetrack+0x14/0x30 kasansavefreeinfo+0x3a/0x60 _kasanslabfree+0x3f/0x50 kfree+0x137/0x370 releasenodes+0xa4/0x100 devresreleasegroup+0x1b2/0x380 i2cdeviceprobe+0x694/0x880 reallyprobe+0x1ca/0x5c0 _driverprobedevice+0x248/0x310 driverprobedevice+0x44/0x120 _deviceattachdriver+0x174/0x220 busforeachdrv+0x100/0x190 _deviceattach+0x206/0x370 busprobedevice+0x123/0x170 deviceadd+0xd25/0x1470 i2cnewclientdevice+0x7a0/0xcd0 dooneinitcall+0x89/0x300 doinitmodule+0x29d/0x7f0 loadmodule+0x4f48/0x69e0 initmodulefromfile+0xe4/0x150 idempotentinitmodule+0x320/0x670 _x64sysfinitmodule+0xbd/0x120 dosyscall64+0xac/0x280 entrySYSCALL64after_hwframe+0x77/0x7f ...
Replace timerdelete() with timerdeletesync() and canceldelayedwork() with canceldelayedworksync() to ensure proper termination of timer and work items before resource cleanup.
This bug was initially identified through static analysis. For reproduction and testing, I created a functional emulation of the tc358743 device via a kernel module and introduced faults through the debugfs interface.
[
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"123039973249754187225055247828979471615",
"144695596057608257639881238776048742242",
"231758131788214178578696818559780391311",
"232990785672454698358783958500566259786",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@228d06c4cbfc750f1216a3fd91b4693b0766d2f6",
"signature_type": "Line",
"id": "CVE-2025-39995-04b43fac"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"44859070342091239544071227407297023557",
"133777746712295431231235515095527086142",
"1324815203527868058172884636682606452",
"89903111141428557326843476320332092650",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f3f3f00bcabbd2ce0a77a2ac7a6797b8646bfd8b",
"signature_type": "Line",
"id": "CVE-2025-39995-0ea9151b"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"44859070342091239544071227407297023557",
"133777746712295431231235515095527086142",
"1324815203527868058172884636682606452",
"89903111141428557326843476320332092650",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2610617effb4454d2f1c434c011ccb5cc7140711",
"signature_type": "Line",
"id": "CVE-2025-39995-14c69953"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"44859070342091239544071227407297023557",
"133777746712295431231235515095527086142",
"1324815203527868058172884636682606452",
"89903111141428557326843476320332092650",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@79d10f4f21a92e459b2276a77be62c59c1502c9d",
"signature_type": "Line",
"id": "CVE-2025-39995-292221e8"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"123039973249754187225055247828979471615",
"144695596057608257639881238776048742242",
"231758131788214178578696818559780391311",
"232990785672454698358783958500566259786",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@70913586c717dd25cfbade7a418e92cc9c99398a",
"signature_type": "Line",
"id": "CVE-2025-39995-5431c940"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"123039973249754187225055247828979471615",
"144695596057608257639881238776048742242",
"231758131788214178578696818559780391311",
"232990785672454698358783958500566259786",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9205fb6e617a1c596d9a9ad2a160ee696e09d520",
"signature_type": "Line",
"id": "CVE-2025-39995-64f5fc56"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"123039973249754187225055247828979471615",
"144695596057608257639881238776048742242",
"231758131788214178578696818559780391311",
"232990785672454698358783958500566259786",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f92181c0e13cad9671d07b15be695a97fc2534a3",
"signature_type": "Line",
"id": "CVE-2025-39995-76ba67b5"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"123039973249754187225055247828979471615",
"144695596057608257639881238776048742242",
"231758131788214178578696818559780391311",
"232990785672454698358783958500566259786",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d17701c156579969470e58b3a906511f8bc018d",
"signature_type": "Line",
"id": "CVE-2025-39995-b526ce06"
},
{
"signature_version": "v1",
"deprecated": false,
"digest": {
"line_hashes": [
"123039973249754187225055247828979471615",
"144695596057608257639881238776048742242",
"231758131788214178578696818559780391311",
"232990785672454698358783958500566259786",
"87429314764290841138507430270363287729",
"71965046152546862702206102063081365074",
"6834324306792414184870805381166180792"
],
"threshold": 0.9
},
"target": {
"file": "drivers/media/i2c/tc358743.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@663faf1179db9663a3793c75e9bc869358bad910",
"signature_type": "Line",
"id": "CVE-2025-39995-bd41c692"
}
]