Bluetooth: vhci: Fix race at creating hci device
commitc9e4a5044e992c8d31977f710009e04bc46fd48d
authorTakashi Iwai <tiwai@suse.de>
Thu, 14 Apr 2016 15:32:19 +0000 (14 17:32 +0200)
committerSasha Levin <sasha.levin@oracle.com>
Fri, 3 Jun 2016 15:30:27 +0000 (3 11:30 -0400)
treee2fc52e2f914318b32912be24e1e94cf3dcdc7c0
parent887f64e66000496335a0bd894d57f45a6b37076b
Bluetooth: vhci: Fix race at creating hci device

[ Upstream commit c7c999cb18da88a881e10e07f0724ad0bfaff770 ]

hci_vhci driver creates a hci device object dynamically upon each
HCI_VENDOR_PKT write.  Although it checks the already created object
and returns an error, it's still racy and may build multiple hci_dev
objects concurrently when parallel writes are performed, as the device
tracks only a single hci_dev object.

This patch introduces a mutex to protect against the concurrent device
creations.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/bluetooth/hci_vhci.c