CVE-2026-99011
Beschrijving NL
In de Linux-kernel is de volgende kwetsbaarheid verholpen:
Bluetooth: SCO: serialiseer de levensduur van sco_conn ten opzichte van sco_recv_scodata()
sco_recv_scodata() werkt de zwakke hcon->sco_data backpointer bij naar een
sterke referentie onder hdev->lock:
hci_dev_lock(hdev);
hcon = hci_conn_hash_lookup_handle(hdev, handle);
... conn = sco_conn_hold_unless_zero(hcon->sco_data);
hci_dev_unlock(hdev);
maar de aanwijzer wordt aan de andere kant gewist zonder die vergrendeling. Wanneer
De laatste sco_conn-referentie wordt verwijderd, sco_conn_free() is uitgevoerd.
conn->hcon->sco_data = NULL;
zonder hdev->lock vastgehouden, zodat het RX-pad hcon->sco_data kon lezen en
roep kref_get_unless_zero() aan op een sco_conn die gelijktijdig is vrijgegeven:
BUG: KASAN: slab-use-after-free in sco_conn_hold_unless_zero+0xbe/0x160
Schrijfopdracht van grootte 4 door taak kworker/u17:0
Werkrij: hci0 hci_rx_work
Oproeptracering:
sco_conn_hold_unless_zero+0xbe/0x160
sco_recv_sco data+0x13f/0x490
hci_rx_work+0x3af/0x730
kref_get_unless_zero() beschermt alleen tegen een nultelling, niet tegen
het back-upgeheugen al wordt vrijgegeven. Geef hcon->sco_data een daadwerkelijke verwijzing naar de sco_conn waarnaar het verwijst, zodat
Het object kan niet worden vrijgegeven zolang de aanwijzer nog is geïnstalleerd, en alleen
wis en verwijder het uit sco_conn_del(), dat wordt uitgevoerd onder hdev->lock (het
bellers, sco_connect_cfm() en sco_disconn_cfm(), houd het vast). De lezer in
sco_recv_scodata() accepteert ook hdev->lock, dus het opslaan en lezen zijn
nu geserialiseerd: het RX-pad observeert ofwel NULL ofwel een referentie die
blijft gegarandeerd geldig totdat het zijn eigen waarde verliest. sco_conn_add() geeft zijn kref_init()-referentie niet langer door aan de aanroeper als
de enige referentie van de verbinding; die initiële referentie is degene die eigendom is van de gebruiker.
via hcon->sco_data, en bellers krijgen hun eigen gegevens via sco_conn_hold(). Omdat de sco_conn nu langer meegaat dan de socket (de associatie zorgt ervoor dat deze blijft bestaan).
(blijft actief totdat de verbinding verbroken wordt), kan de hci_conn niet langer worden verbroken.
vanuit sco_conn_free() zonder terugval naar het sluiten van de socket: het sluiten van een verbonden verbinding
De SCO-socket moet de verbinding nog steeds verbreken. Verplaats het eigenaarschap van hci_conn naar de
socket in plaats daarvan: __sco_chan_add() neemt een hci_conn-referentie en het is
vrijgegeven uit sco_chan_del() en sco_sock_destruct(), precies één keer. De
sco_conn heeft geen verwijzing meer naar hci_conn, waardoor sco_conn_add() stopt.
Het consumeren van één en sco_connect() laat de hci_connect_sco()-referentie vallen.
elk pad; sco_connect_cfm() heeft zijn hci_conn_hold()-dansje niet meer nodig.
Origineel (Engels) tonen
In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: SCO: serialise sco_conn lifetime against sco_recv_scodata()
sco_recv_scodata() upgrades the weak hcon->sco_data back-pointer to a
strong reference under hdev->lock:
hci_dev_lock(hdev);
hcon = hci_conn_hash_lookup_handle(hdev, handle);
...
conn = sco_conn_hold_unless_zero(hcon->sco_data);
hci_dev_unlock(hdev);
but the pointer is cleared from the other side without that lock. When
the last sco_conn reference is dropped, sco_conn_free() ran
conn->hcon->sco_data = NULL;
with no hdev->lock held, so the RX path could read hcon->sco_data and
call kref_get_unless_zero() on an sco_conn that was concurrently freed:
BUG: KASAN: slab-use-after-free in sco_conn_hold_unless_zero+0xbe/0x160
Write of size 4 by task kworker/u17:0
Workqueue: hci0 hci_rx_work
Call Trace:
sco_conn_hold_unless_zero+0xbe/0x160
sco_recv_scodata+0x13f/0x490
hci_rx_work+0x3af/0x730
kref_get_unless_zero() only guards against a zero refcount, not against
the backing memory already being freed.
Give hcon->sco_data an actual reference on the sco_conn it points to, so
the object cannot be freed while the pointer is still installed, and only
clear and drop it from sco_conn_del(), which runs under hdev->lock (its
callers, sco_connect_cfm() and sco_disconn_cfm(), hold it). The reader in
sco_recv_scodata() also takes hdev->lock, so the store and the read are
now serialised: the RX path either observes NULL or a reference that is
guaranteed to stay valid until it drops its own.
sco_conn_add() no longer hands its kref_init() reference to the caller as
the connection's only reference; that initial reference is the one owned
by hcon->sco_data, and callers get their own via sco_conn_hold().
Because the sco_conn can now outlive the socket (the association keeps it
alive until the link goes down), the hci_conn can no longer be dropped
from sco_conn_free() without regressing socket close: closing a connected
SCO socket must still tear the link down. Move hci_conn ownership to the
socket instead: __sco_chan_add() takes an hci_conn reference and it is
released from sco_chan_del() and sco_sock_destruct(), exactly once. The
sco_conn no longer owns an hci_conn reference, so sco_conn_add() stops
consuming one and sco_connect() drops the hci_connect_sco() reference on
every path; sco_connect_cfm() no longer needs its hci_conn_hold() dance.