]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
Bluetooth: Fix race condition in hci_release_sock()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 15 Jan 2020 17:49:04 +0000 (20:49 +0300)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 6 Feb 2020 16:32:35 +0000 (16:32 +0000)
commitd3909c150bae6441bbe60f9d091f0685b0050f21
tree40b3d24d142e8af5f0f4a1c5295b0e2930c381b7
parentd38dc05fa41ceb3fd1953e2db635c8203fae50dc
Bluetooth: Fix race condition in hci_release_sock()

BugLink: https://bugs.launchpad.net/bugs/1862203
commit 11eb85ec42dc8c7a7ec519b90ccf2eeae9409de8 upstream.

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.

Reported-by: syzbot+eba992608adf3d796bcc@syzkaller.appspotmail.com
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
net/bluetooth/hci_sock.c