Myungho Jung 59ae59920a Bluetooth: Fix decrementing reference count twice in releasing socket
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
hci_sock_release().

Reported-by: syzbot+fdc00003f4efff43bc5b@syzkaller.appspotmail.com
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Zubin Mithra <zsm@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27 09:33:47 +02:00
..
2018-05-16 10:06:51 +02:00
2019-02-23 09:05:14 +01:00
2015-10-07 04:27:43 -07:00
2018-12-01 09:46:34 +01:00
2019-02-06 19:43:06 +01:00
2019-03-23 08:44:34 +01:00
2019-03-23 08:44:30 +01:00
2019-01-13 10:05:28 +01:00
2018-02-25 11:03:37 +01:00