lkml.org 
[lkml]   [2023]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in __lock_sock
From
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [bluetooth?] KASAN: slab-use-after-free Read in __lock_sock
Author: eadavis@qq.com

please test uaf in __lock_sock

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c

diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..0bf3d90c1442 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -285,6 +285,7 @@ static int sco_connect(struct sock *sk)
goto unlock;
}

+ hci_conn_get(hcon);
/* Update source addr of the socket */
bacpy(&sco_pi(sk)->src, &hcon->src);

@@ -297,10 +298,12 @@ static int sco_connect(struct sock *sk)
}

release_sock(sk);
+ printk("hd: %p, hcd: %p\n", &hdev->dev, &hcon->dev);

unlock:
hci_dev_unlock(hdev);
- hci_dev_put(hdev);
+ if (err)
+ hci_dev_put(hdev);
return err;
}

@@ -438,12 +441,13 @@ static void __sco_sock_close(struct sock *sk)
case BT_CONNECTED:
case BT_CONFIG:
if (sco_pi(sk)->conn->hcon) {
+ struct hci_conn *hcon = sco_pi(sk)->conn->hcon;
sk->sk_state = BT_DISCONN;
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
sco_conn_lock(sco_pi(sk)->conn);
- hci_conn_drop(sco_pi(sk)->conn->hcon);
sco_pi(sk)->conn->hcon = NULL;
sco_conn_unlock(sco_pi(sk)->conn);
+ hci_conn_put(hcon);
} else
sco_chan_del(sk, ECONNRESET);
break;
\
 
 \ /
  Last update: 2023-11-25 02:33    [W:0.257 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site