In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: L2CAP: Fix slab-use-after-free in l2cap_connect()
Extend a critical section to prevent chan from early freeing. Also make the l2cap_connect() return type void. Nothing is using the returned value but it is ugly to return a potentially freed pointer. Making it void will help with backports because earlier kernels did use the return value. Now the compile will break for kernels where this patch is not a complete fix.
Call stack summary:
[use] l2capbredrsigcmd l2capconnect ┌ mutexlock(&conn->chanlock); │ chan = pchan->ops->newconnection(pchan); <- alloc chan │ _l2capchanadd(conn, chan); │ l2capchanhold(chan); │ listadd(&chan->list, &conn->chanl); ... (1) └ mutexunlock(&conn->chanlock); chan->conf_state ... (4) <- use after free
[free] l2capconndel ┌ mutexlock(&conn->chanlock); │ foreach chan in conn->chanl: ... (2) │ l2capchanput(chan); │ l2capchandestroy │ kfree(chan) ... (3) <- chan freed └ mutexunlock(&conn->chan_lock);
================================================================== BUG: KASAN: slab-use-after-free in instrumentatomicread include/linux/instrumented.h:68 [inline] BUG: KASAN: slab-use-after-free in testbit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline] BUG: KASAN: slab-use-after-free in l2capconnect+0xa67/0x11a0 net/bluetooth/l2capcore.c:4260 Read of size 8 at addr ffff88810bf040a0 by task kworker/u3:1/311
[
{
"digest": {
"length": 3053.0,
"function_hash": "246981553662201841153957827037419308884"
},
"target": {
"file": "net/bluetooth/l2cap_core.c",
"function": "l2cap_connect"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4d7b41c0e43995b0e992b9f8903109275744b658",
"id": "CVE-2024-36013-283b05c8",
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function"
},
{
"digest": {
"line_hashes": [
"216375717422549860408192354593323189894",
"23900696749263022884795352863207778227",
"105914298259188537450292867085459240490",
"308282589289322510363247024256371083281",
"264885713325477104457328682345652997752",
"165938746058252904747623681037180880770",
"321101580678447991812783194849548123963",
"239467983888671578152303929808000937563",
"65978536021795811297021724348075402688",
"151743590662336340404126252282592912939",
"241921427207600669279615837620989072115",
"239409782948611592579014065046550904777",
"291854006330047590137980307779264284676",
"227176899615270123034945454522038736646",
"190268633123627826075428139703500942803",
"152585511663439909537632467623675238842",
"165198765786842959769157280372969986529",
"16594563306773867011804310248707682485",
"286139408677902614120773833559665847089",
"157672344917527926826029335217600731960",
"339813131835318437100150781638007145239",
"260326705004890858871953511939189857545",
"23842695864096845240787993356895617770",
"257526218448431247741191888884476730300",
"309201645531959891932268795799873332857",
"321817408291178054510156971203499931940",
"229318690409252345806809614687322656414",
"124297069260508587188200133823420686745",
"35984587845791665935318509525783097624",
"80298463559340151165385644066545844485"
],
"threshold": 0.9
},
"target": {
"file": "net/bluetooth/l2cap_core.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cfe560c7050bfb37b0d2491bbe7cd8b59e77fdc5",
"id": "CVE-2024-36013-537550b2",
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line"
},
{
"digest": {
"length": 3053.0,
"function_hash": "246981553662201841153957827037419308884"
},
"target": {
"file": "net/bluetooth/l2cap_core.c",
"function": "l2cap_connect"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@826af9d2f69567c646ff46d10393d47e30ad23c6",
"id": "CVE-2024-36013-54b1d964",
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function"
},
{
"digest": {
"line_hashes": [
"216375717422549860408192354593323189894",
"23900696749263022884795352863207778227",
"105914298259188537450292867085459240490",
"308282589289322510363247024256371083281",
"264885713325477104457328682345652997752",
"165938746058252904747623681037180880770",
"321101580678447991812783194849548123963",
"239467983888671578152303929808000937563",
"65978536021795811297021724348075402688",
"151743590662336340404126252282592912939",
"241921427207600669279615837620989072115",
"239409782948611592579014065046550904777",
"291854006330047590137980307779264284676",
"227176899615270123034945454522038736646",
"190268633123627826075428139703500942803",
"152585511663439909537632467623675238842",
"165198765786842959769157280372969986529",
"16594563306773867011804310248707682485",
"286139408677902614120773833559665847089",
"157672344917527926826029335217600731960",
"339813131835318437100150781638007145239",
"260326705004890858871953511939189857545",
"23842695864096845240787993356895617770",
"257526218448431247741191888884476730300",
"309201645531959891932268795799873332857",
"321817408291178054510156971203499931940",
"229318690409252345806809614687322656414",
"124297069260508587188200133823420686745",
"35984587845791665935318509525783097624",
"80298463559340151165385644066545844485"
],
"threshold": 0.9
},
"target": {
"file": "net/bluetooth/l2cap_core.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4d7b41c0e43995b0e992b9f8903109275744b658",
"id": "CVE-2024-36013-90182ff1",
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line"
},
{
"digest": {
"line_hashes": [
"216375717422549860408192354593323189894",
"23900696749263022884795352863207778227",
"105914298259188537450292867085459240490",
"308282589289322510363247024256371083281",
"264885713325477104457328682345652997752",
"165938746058252904747623681037180880770",
"321101580678447991812783194849548123963",
"239467983888671578152303929808000937563",
"65978536021795811297021724348075402688",
"151743590662336340404126252282592912939",
"241921427207600669279615837620989072115",
"239409782948611592579014065046550904777",
"291854006330047590137980307779264284676",
"227176899615270123034945454522038736646",
"190268633123627826075428139703500942803",
"152585511663439909537632467623675238842",
"165198765786842959769157280372969986529",
"16594563306773867011804310248707682485",
"286139408677902614120773833559665847089",
"157672344917527926826029335217600731960",
"339813131835318437100150781638007145239",
"260326705004890858871953511939189857545",
"23842695864096845240787993356895617770",
"257526218448431247741191888884476730300",
"309201645531959891932268795799873332857",
"321817408291178054510156971203499931940",
"229318690409252345806809614687322656414",
"124297069260508587188200133823420686745",
"35984587845791665935318509525783097624",
"80298463559340151165385644066545844485"
],
"threshold": 0.9
},
"target": {
"file": "net/bluetooth/l2cap_core.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@826af9d2f69567c646ff46d10393d47e30ad23c6",
"id": "CVE-2024-36013-9c9977f8",
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line"
},
{
"digest": {
"length": 3053.0,
"function_hash": "246981553662201841153957827037419308884"
},
"target": {
"file": "net/bluetooth/l2cap_core.c",
"function": "l2cap_connect"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cfe560c7050bfb37b0d2491bbe7cd8b59e77fdc5",
"id": "CVE-2024-36013-bf6d0fa9",
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function"
}
]