Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
[firefly-linux-kernel-4.4.55.git] / drivers / bluetooth / hci_ldisc.c
index 998833d93c13c724ffbc828ab0f62ad07e1c438c..720148294e648473a1a82cc0c68f50ac1fd923c3 100644 (file)
@@ -101,7 +101,7 @@ static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type)
                break;
 
        case HCI_SCODATA_PKT:
-               hdev->stat.cmd_tx++;
+               hdev->stat.sco_tx++;
                break;
        }
 }
@@ -256,9 +256,16 @@ static int hci_uart_tty_open(struct tty_struct *tty)
 
        BT_DBG("tty %p", tty);
 
+       /* FIXME: This btw is bogus, nothing requires the old ldisc to clear
+          the pointer */
        if (hu)
                return -EEXIST;
 
+       /* Error if the tty has no write op instead of leaving an exploitable
+          hole */
+       if (tty->ops->write == NULL)
+               return -EOPNOTSUPP;
+
        if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
                BT_ERR("Can't allocate control structure");
                return -ENFILE;