]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bluetooth: Fix missing NULL check
authorAlan Cox <alan@linux.intel.com>
Fri, 22 Oct 2010 13:11:26 +0000 (14:11 +0100)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 6 Jan 2011 23:08:19 +0000 (18:08 -0500)
commit c19483cc5e56ac5e22dd19cf25ba210ab1537773 upstream.

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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/bluetooth/hci_ldisc.c

index 76a1abb8f2142772bd1993bf99d5771dcd1d980a..283b127cea743446e060ac582434f66c0a60d603 100644 (file)
@@ -258,9 +258,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;