Commit c19483cc authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

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: default avatarAlan Cox <alan@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d4429f60
...@@ -256,9 +256,16 @@ static int hci_uart_tty_open(struct tty_struct *tty) ...@@ -256,9 +256,16 @@ static int hci_uart_tty_open(struct tty_struct *tty)
BT_DBG("tty %p", tty); BT_DBG("tty %p", tty);
/* FIXME: This btw is bogus, nothing requires the old ldisc to clear
the pointer */
if (hu) if (hu)
return -EEXIST; 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))) { if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) {
BT_ERR("Can't allocate control structure"); BT_ERR("Can't allocate control structure");
return -ENFILE; return -ENFILE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment