From: Eugene Teo <eugeneteo@kernel.sg>
To: linux-kernel@vger.kernel.org
Cc: marcel@holtmann.org
Subject: [PATCH] drivers/bluetooth/hci_ldisc.c: fix possible NULL dereferences
Date: Sun, 29 Jul 2007 22:47:36 +0800 [thread overview]
Message-ID: <20070729144736.GA13275@kernel.sg> (raw)
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@kernel.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);
}
next reply other threads:[~2007-07-29 14:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-29 14:47 Eugene Teo [this message]
2007-07-29 16:49 ` [PATCH] drivers/bluetooth/hci_ldisc.c: fix possible NULL dereferences Marcel Holtmann
2007-07-29 22:53 ` Eugene Teo
2007-07-30 6:42 ` Marcel Holtmann
2007-07-30 6:48 ` Eugene Teo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070729144736.GA13275@kernel.sg \
--to=eugeneteo@kernel.sg \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.