Bluetooth: hci_ldisc: Ensure hu->hdev set to NULL before freeing hdev
authorDean Jenkins <Dean_Jenkins@mentor.com>
Thu, 20 Apr 2017 17:06:40 +0000 (18:06 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 22 Apr 2017 08:28:40 +0000 (10:28 +0200)
commita225b8c70af9368cfcb52a3608bc862bc88a7801
tree81a84e350a07ff915609bca3d88001f34c73f873
parentcb926520e18e6aecc63614b8aa2e40d431aa29cd
Bluetooth: hci_ldisc: Ensure hu->hdev set to NULL before freeing hdev

When hci_register_dev() fails, hu->hdev should be set to NULL before
freeing hdev. This avoids potential use of hu->hdev after it has been
freed.

This commit sets hu->hdev to NULL before calling hci_free_dev() in error
handling scenarios in hci_uart_init_work() and hci_uart_register_dev().

Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_ldisc.c