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:   Tue, 26 Mar 2019 15:29:54 +0900
From:   Greg Kroah-Hartman <>
Cc:     Greg Kroah-Hartman <>,,,
        Myungho Jung <>,
        Marcel Holtmann <>
Subject: [PATCH 4.9 15/30] Bluetooth: Fix decrementing reference count twice in releasing socket

4.9-stable review patch.  If anyone has any objections, please let me know.


From: Myungho Jung <>

commit e20a2e9c42c9e4002d9e338d74e7819e88d77162 upstream.

When releasing socket, it is possible to enter hci_sock_release() and
hci_sock_dev_event(HCI_DEV_UNREG) at the same time in different thread.
The reference count of hdev should be decremented only once from one of
them but if storing hdev to local variable in hci_sock_release() before
detached from socket and setting to NULL in hci_sock_dev_event(),
hci_dev_put(hdev) is unexpectedly called twice. This is resolved by
referencing hdev from socket after bt_sock_unlink() in

Signed-off-by: Myungho Jung <>
Signed-off-by: Marcel Holtmann <>
Signed-off-by: Greg Kroah-Hartman <>

 net/bluetooth/hci_sock.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -826,8 +826,6 @@ static int hci_sock_release(struct socke
 	if (!sk)
 		return 0;
-	hdev = hci_pi(sk)->hdev;
 	switch (hci_pi(sk)->channel) {
@@ -849,6 +847,7 @@ static int hci_sock_release(struct socke
 	bt_sock_unlink(&hci_sk_list, sk);
+	hdev = hci_pi(sk)->hdev;
 	if (hdev) {
 		if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
 			/* When releasing an user channel exclusive access,

Powered by blists - more mailing lists