From: Chan-yeol Park Date: Tue, 2 Apr 2013 12:24:22 +0000 (+0900) Subject: Bluetooth: Fix possible NULL dereference in hci_uart_tty_receive X-Git-Tag: v3.10-rc2~34^2~21^2^2~18^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=788f0923d3cb5256b12113c041c2381e4b3cecf6;p=profile%2Fcommon%2Fkernel-common.git Bluetooth: Fix possible NULL dereference in hci_uart_tty_receive This patch adds a NULL check for the HCI UART ldisc driver because some of HCI UART drivers allow hci_uart_tty_receive function to be called even though the HCI device hasn't been registered yet. Signed-off-by: Chan-yeol Park Signed-off-by: Johan Hedberg --- diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index ed0fade..d710d8b 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -388,7 +388,10 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *f spin_lock(&hu->rx_lock); hu->proto->recv(hu, (void *) data, count); - hu->hdev->stat.byte_rx += count; + + if (hu->hdev) + hu->hdev->stat.byte_rx += count; + spin_unlock(&hu->rx_lock); tty_unthrottle(tty);