lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070729144736.GA13275@kernel.sg>
Date:	Sun, 29 Jul 2007 22:47:36 +0800
From:	Eugene Teo <eugeneteo@...nel.sg>
To:	linux-kernel@...r.kernel.org
Cc:	marcel@...tmann.org
Subject: [PATCH] drivers/bluetooth/hci_ldisc.c: fix possible NULL
	dereferences

Commit 22ad42033b7d2b3d7928fba9f89d1c7f8a3c9581 did not completely fix all 
the possible NULL dereferences. Besides hci_uart_close(), we also need to 
make sure that hdev is valid before calling hci_{unregister,free}_dev().

Signed-off-by: Eugene Teo <eugeneteo@...nel.sg>
---
 drivers/bluetooth/hci_ldisc.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 6055b9c..4813f7c 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -308,11 +308,10 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 	if (hu) {
 		struct hci_dev *hdev = hu->hdev;
 
-		if (hdev)
+		if (hdev) {
 			hci_uart_close(hdev);
-
-		if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
-			hu->proto->close(hu);
+			if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags))
+				hu->proto->close(hu);
 			hci_unregister_dev(hdev);
 			hci_free_dev(hdev);
 		}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ