| OLD | NEW |
| 1 /* | 1 /* |
| 2 * | 2 * |
| 3 * Bluetooth HCI UART driver | 3 * Bluetooth HCI UART driver |
| 4 * | 4 * |
| 5 * Copyright (C) 2000-2001 Qualcomm Incorporated | 5 * Copyright (C) 2000-2001 Qualcomm Incorporated |
| 6 * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> | 6 * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> |
| 7 * Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org> | 7 * Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org> |
| 8 * | 8 * |
| 9 * | 9 * |
| 10 * This program is free software; you can redistribute it and/or modify | 10 * This program is free software; you can redistribute it and/or modify |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 * tty pointer to tty info structure | 249 * tty pointer to tty info structure |
| 250 * Return Value: | 250 * Return Value: |
| 251 * 0 if success, otherwise error code | 251 * 0 if success, otherwise error code |
| 252 */ | 252 */ |
| 253 static int hci_uart_tty_open(struct tty_struct *tty) | 253 static int hci_uart_tty_open(struct tty_struct *tty) |
| 254 { | 254 { |
| 255 struct hci_uart *hu = (void *) tty->disc_data; | 255 struct hci_uart *hu = (void *) tty->disc_data; |
| 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; |
| 265 } | 272 } |
| 266 | 273 |
| 267 tty->disc_data = hu; | 274 tty->disc_data = hu; |
| 268 hu->tty = tty; | 275 hu->tty = tty; |
| 269 tty->receive_room = 65536; | 276 tty->receive_room = 65536; |
| 270 | 277 |
| 271 spin_lock_init(&hu->rx_lock); | 278 spin_lock_init(&hu->rx_lock); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 module_exit(hci_uart_exit); | 601 module_exit(hci_uart_exit); |
| 595 | 602 |
| 596 module_param(reset, bool, 0644); | 603 module_param(reset, bool, 0644); |
| 597 MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); | 604 MODULE_PARM_DESC(reset, "Send HCI reset command on initialization"); |
| 598 | 605 |
| 599 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); | 606 MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
| 600 MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); | 607 MODULE_DESCRIPTION("Bluetooth HCI UART driver ver " VERSION); |
| 601 MODULE_VERSION(VERSION); | 608 MODULE_VERSION(VERSION); |
| 602 MODULE_LICENSE("GPL"); | 609 MODULE_LICENSE("GPL"); |
| 603 MODULE_ALIAS_LDISC(N_HCI); | 610 MODULE_ALIAS_LDISC(N_HCI); |
| OLD | NEW |