aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/hci_ldisc.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/bluetooth/hci_ldisc.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r--drivers/bluetooth/hci_ldisc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 998833d93c13..48ad2a7ab080 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -101,7 +101,7 @@ static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type)
101 break; 101 break;
102 102
103 case HCI_SCODATA_PKT: 103 case HCI_SCODATA_PKT:
104 hdev->stat.cmd_tx++; 104 hdev->stat.sco_tx++;
105 break; 105 break;
106 } 106 }
107} 107}
@@ -256,9 +256,16 @@ static int hci_uart_tty_open(struct tty_struct *tty)
256 256
257 BT_DBG("tty %p", tty); 257 BT_DBG("tty %p", tty);
258 258
259 /* FIXME: This btw is bogus, nothing requires the old ldisc to clear
260 the pointer */
259 if (hu) 261 if (hu)
260 return -EEXIST; 262 return -EEXIST;
261 263
264 /* Error if the tty has no write op instead of leaving an exploitable
265 hole */
266 if (tty->ops->write == NULL)
267 return -EOPNOTSUPP;
268
262 if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { 269 if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
263 BT_ERR("Can't allocate control structure"); 270 BT_ERR("Can't allocate control structure");
264 return -ENFILE; 271 return -ENFILE;
@@ -304,8 +311,10 @@ static void hci_uart_tty_close(struct tty_struct *tty)
304 311
305 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { 312 if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
306 hu->proto->close(hu); 313 hu->proto->close(hu);
307 hci_unregister_dev(hdev); 314 if (hdev) {
308 hci_free_dev(hdev); 315 hci_unregister_dev(hdev);
316 hci_free_dev(hdev);
317 }
309 } 318 }
310 } 319 }
311} 320}
@@ -389,6 +398,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
389 hdev->flush = hci_uart_flush; 398 hdev->flush = hci_uart_flush;
390 hdev->send = hci_uart_send_frame; 399 hdev->send = hci_uart_send_frame;
391 hdev->destruct = hci_uart_destruct; 400 hdev->destruct = hci_uart_destruct;
401 hdev->parent = hu->tty->dev;
392 402
393 hdev->owner = THIS_MODULE; 403 hdev->owner = THIS_MODULE;
394 404