From: Dean Jenkins Date: Thu, 20 Apr 2017 17:06:41 +0000 (+0100) Subject: Bluetooth: hci_ldisc: Add missing clear HCI_UART_PROTO_READY X-Git-Tag: v4.14-rc1~1025^2~109^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d160b74da85a4ec072b076db056e27ba7246eba0;p=platform%2Fkernel%2Flinux-rpi.git Bluetooth: hci_ldisc: Add missing clear HCI_UART_PROTO_READY Ensure that HCI_UART_PROTO_READY is cleared before close(hu) is called which closes the Data Link protocol layer. Therefore, add the missing bit clear of HCI_UART_PROTO_READY to hci_uart_init_work() so that the flag is cleared when hci_register_dev fails. Without the fix, the functions of the Data Link protocol layer could potentially be accessed after that layer has been closed. This could lead to a crash as memory would have been freed in that layer. Signed-off-by: Dean Jenkins Signed-off-by: Marcel Holtmann --- diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index b1096d1..c53513c 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -188,6 +188,7 @@ static void hci_uart_init_work(struct work_struct *work) hdev = hu->hdev; hu->hdev = NULL; hci_free_dev(hdev); + clear_bit(HCI_UART_PROTO_READY, &hu->flags); hu->proto->close(hu); return; }