lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 15 Jan 2020 20:49:04 +0300
From:   Dan Carpenter <>
To:     Marcel Holtmann <>,
        syzbot <>
Cc:     Johan Hedberg <>,
        "David S. Miller" <>,,,,
Subject: [PATCH] Bluetooth: Fix race condition in hci_release_sock()

Syzbot managed to trigger a use after free "KASAN: use-after-free Write
in hci_sock_bind".  I have reviewed the code manually and one possibly
cause I have found is that we are not holding lock_sock(sk) when we do
the hci_dev_put(hdev) in hci_sock_release().  My theory is that the bind
and the release are racing against each other which results in this use
after free.

Signed-off-by: Dan Carpenter <>
Not tested!  Please review very very carefully!

I feel like maybe someone should audit the (struct proto_ops)->release()
functions because there may be similar bugs to this in other drivers.

 net/bluetooth/hci_sock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 5d0ed28c0d3a..c86598ff4283 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -831,6 +831,8 @@ static int hci_sock_release(struct socket *sock)
 	if (!sk)
 		return 0;
+	lock_sock(sk);
 	switch (hci_pi(sk)->channel) {
@@ -878,6 +880,7 @@ static int hci_sock_release(struct socket *sock)
+	release_sock(sk);
 	return 0;

Powered by blists - more mailing lists