aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/hci_ldisc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-04-12 11:57:53 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-12 11:57:53 -0400
commit69fb78121bf86c87490ea1453e310a39c320a70a (patch)
tree490484df49b2f3ad8d8cea6e4a9e27bc772ef99a /drivers/bluetooth/hci_ldisc.c
parent9a6f2b0113c8fce815db7c9d23754bdea4b428a0 (diff)
parent8805eea2494a2837983bc4aaaf6842c89666ec25 (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says: ==================== pull request: bluetooth-next 2016-04-12 Here's a set of Bluetooth & 802.15.4 patches intended for the 4.7 kernel: - Fix for race condition in vhci driver - Memory leak fix for ieee802154/adf7242 driver - Improvements to deal with single-mode (LE-only) Bluetooth controllers - Fix for allowing the BT_SECURITY_FIPS security level - New BCM2E71 ACPI ID - NULL pointer dereference fix fox hci_ldisc driver Let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r--drivers/bluetooth/hci_ldisc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index c00168a5bb80..49b3e1e2d236 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -227,7 +227,7 @@ static int hci_uart_flush(struct hci_dev *hdev)
227 tty_ldisc_flush(tty); 227 tty_ldisc_flush(tty);
228 tty_driver_flush_buffer(tty); 228 tty_driver_flush_buffer(tty);
229 229
230 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) 230 if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
231 hu->proto->flush(hu); 231 hu->proto->flush(hu);
232 232
233 return 0; 233 return 0;
@@ -492,7 +492,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
492 492
493 cancel_work_sync(&hu->write_work); 493 cancel_work_sync(&hu->write_work);
494 494
495 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { 495 if (test_and_clear_bit(HCI_UART_PROTO_READY, &hu->flags)) {
496 if (hdev) { 496 if (hdev) {
497 if (test_bit(HCI_UART_REGISTERED, &hu->flags)) 497 if (test_bit(HCI_UART_REGISTERED, &hu->flags))
498 hci_unregister_dev(hdev); 498 hci_unregister_dev(hdev);
@@ -500,6 +500,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
500 } 500 }
501 hu->proto->close(hu); 501 hu->proto->close(hu);
502 } 502 }
503 clear_bit(HCI_UART_PROTO_SET, &hu->flags);
503 504
504 kfree(hu); 505 kfree(hu);
505} 506}
@@ -526,7 +527,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
526 if (tty != hu->tty) 527 if (tty != hu->tty)
527 return; 528 return;
528 529
529 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) 530 if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
530 hci_uart_tx_wakeup(hu); 531 hci_uart_tx_wakeup(hu);
531} 532}
532 533
@@ -550,7 +551,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
550 if (!hu || tty != hu->tty) 551 if (!hu || tty != hu->tty)
551 return; 552 return;
552 553
553 if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) 554 if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))
554 return; 555 return;
555 556
556 /* It does not need a lock here as it is already protected by a mutex in 557 /* It does not need a lock here as it is already protected by a mutex in
@@ -638,9 +639,11 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id)
638 return err; 639 return err;
639 640
640 hu->proto = p; 641 hu->proto = p;
642 set_bit(HCI_UART_PROTO_READY, &hu->flags);
641 643
642 err = hci_uart_register_dev(hu); 644 err = hci_uart_register_dev(hu);
643 if (err) { 645 if (err) {
646 clear_bit(HCI_UART_PROTO_READY, &hu->flags);
644 p->close(hu); 647 p->close(hu);
645 return err; 648 return err;
646 } 649 }