diff options
author | Alan Cox <alan@linux.intel.com> | 2010-10-22 09:11:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 11:33:18 -0400 |
commit | c19483cc5e56ac5e22dd19cf25ba210ab1537773 (patch) | |
tree | 8255f43e5ba324f3718c375fce42047d677ae6ff /drivers/bluetooth/hci_ldisc.c | |
parent | d4429f608abde89e8bc1e24b43cd503feb95c496 (diff) |
bluetooth: Fix missing NULL check
Fortunately this is only exploitable on very unusual hardware.
[Reported a while ago but nothing happened so just fixing it]
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 998833d93c13..17361bad46dd 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -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; |