Skip to content

Commit bf3feec

Browse files
jhovoldgregkh
authored andcommitted
Bluetooth: hci_bcm: add missing tty-device sanity check
commit 95065a61e9bf25fb85295127fba893200c2bbbd8 upstream. Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty. Fixes: 0395ffc ("Bluetooth: hci_bcm: Add PM for BCM devices") Cc: Frederic Danis <frederic.danis@linux.intel.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ff1c4cf commit bf3feec

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/bluetooth/hci_bcm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ static int bcm_open(struct hci_uart *hu)
287287

288288
hu->priv = bcm;
289289

290+
if (!hu->tty->dev)
291+
goto out;
292+
290293
mutex_lock(&bcm_device_lock);
291294
list_for_each(p, &bcm_device_list) {
292295
struct bcm_device *dev = list_entry(p, struct bcm_device, list);
@@ -307,7 +310,7 @@ static int bcm_open(struct hci_uart *hu)
307310
}
308311

309312
mutex_unlock(&bcm_device_lock);
310-
313+
out:
311314
return 0;
312315
}
313316

0 commit comments

Comments
 (0)