All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: add hdev check to avoid passing null pointer
@ 2016-01-21  4:45 Fugang Duan
  2016-01-21  8:43 ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Fugang Duan @ 2016-01-21  4:45 UTC (permalink / raw)
  To: marcel; +Cc: johannes.berg, jslaby, linux-bluetooth, fugang.duan

Function hci_mgmt_cmd() may pass hdev with null pointer to hci_mgmt_handler->func()
like below code:
	err = handler->func(sk, hdev, cp, len);

Add hdev check to avoid passing null pointer.

Signed-off-by: Fugang Duan <B38611@freescale.com>
---
 net/bluetooth/hci_sock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 1298d72..7fdfc80 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1186,6 +1186,8 @@ static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
 
 	if (hdev && chan->hdev_init)
 		chan->hdev_init(sk, hdev);
+	else if (!hdev)
+		goto done;
 
 	cp = buf + sizeof(*hdr);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] Bluetooth: add hdev check to avoid passing null pointer
@ 2016-01-19 10:34 Fugang Duan
  2016-01-19 13:04 ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Fugang Duan @ 2016-01-19 10:34 UTC (permalink / raw)
  To: gustavo, marcel; +Cc: linux-bluetooth, johan.hedberg, b38611

Function hci_mgmt_cmd() may pass hdev with null pointer to hci_mgmt_handler->func()
like below code:
	err = handler->func(sk, hdev, cp, len);

Add hdev check to avoid passing null pointer.

Signed-off-by: Fugang Duan <B38611@freescale.com>
---
 net/bluetooth/hci_sock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 1298d72..7fdfc80 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -1186,6 +1186,8 @@ static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
 
 	if (hdev && chan->hdev_init)
 		chan->hdev_init(sk, hdev);
+	else if (!hdev)
+		goto done;
 
 	cp = buf + sizeof(*hdr);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-21  9:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21  4:45 [PATCH] Bluetooth: add hdev check to avoid passing null pointer Fugang Duan
2016-01-21  8:43 ` Johan Hedberg
2016-01-21  9:06   ` Fugang Duan
  -- strict thread matches above, loose matches on Subject: below --
2016-01-19 10:34 Fugang Duan
2016-01-19 13:04 ` Johan Hedberg
2016-01-21  9:23   ` Fugang Duan

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.