Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7ace17a authored by Rupesh Tatiya's avatar Rupesh Tatiya
Browse files

bluetooth: Check for NULL pointers in input args



There is a possibility that line discipline receives data before
variable proto is set which leads to kernel crash.
Check if proto is valid.

Change-Id: I09e4ca692ccef6dcc2f0acd78ce3847878d17188
Signed-off-by: default avatarRupesh Tatiya <rtatiya@codeaurora.org>
parent 6e11466b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -386,12 +386,15 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *f
{
	struct hci_uart *hu = (void *)tty->disc_data;

	if (!hu || tty != hu->tty)
	if (!hu || tty != hu->tty || !data)
		return;

	if (!test_bit(HCI_UART_PROTO_SET, &hu->flags))
		return;

	if (!hu->proto)
		return;

	spin_lock(&hu->rx_lock);
	hu->proto->recv(hu, (void *) data, count);