All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt
@ 2022-01-22  8:27 Soenke Huster
  2022-01-22  9:04 ` bluez.test.bot
  2022-01-22 21:39 ` [PATCH] " Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Soenke Huster @ 2022-01-22  8:27 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	David S. Miller, Jakub Kicinski
  Cc: Soenke Huster, linux-bluetooth, netdev, linux-kernel

msft_find_handle_data returns NULL if it can't find the handle.
Therefore, handle_data must be checked, otherwise a null pointer
is dereferenced.

Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
---
 net/bluetooth/msft.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 484540855863..d2cf92e834f7 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -705,6 +705,9 @@ static void msft_monitor_device_evt(struct hci_dev *hdev, struct sk_buff *skb)
 
 	handle_data = msft_find_handle_data(hdev, ev->monitor_handle, false);
 
+	if (!handle_data)
+		return;
+
 	switch (ev->addr_type) {
 	case ADDR_LE_DEV_PUBLIC:
 		addr_type = BDADDR_LE_PUBLIC;
-- 
2.34.1


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

* RE: Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt
  2022-01-22  8:27 [PATCH] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt Soenke Huster
@ 2022-01-22  9:04 ` bluez.test.bot
  2022-01-22 21:39 ` [PATCH] " Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-01-22  9:04 UTC (permalink / raw)
  To: linux-bluetooth, soenke.huster

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=607456

---Test result---

Test Summary:
CheckPatch                    PASS      1.69 seconds
GitLint                       PASS      0.98 seconds
SubjectPrefix                 PASS      0.87 seconds
BuildKernel                   PASS      35.09 seconds
BuildKernel32                 PASS      30.74 seconds
Incremental Build with patchesPASS      41.41 seconds
TestRunner: Setup             PASS      540.82 seconds
TestRunner: l2cap-tester      PASS      15.14 seconds
TestRunner: bnep-tester       PASS      6.82 seconds
TestRunner: mgmt-tester       PASS      115.33 seconds
TestRunner: rfcomm-tester     PASS      8.59 seconds
TestRunner: sco-tester        PASS      8.86 seconds
TestRunner: smp-tester        PASS      8.68 seconds
TestRunner: userchan-tester   PASS      7.10 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt
  2022-01-22  8:27 [PATCH] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt Soenke Huster
  2022-01-22  9:04 ` bluez.test.bot
@ 2022-01-22 21:39 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2022-01-22 21:39 UTC (permalink / raw)
  To: Soenke Huster
  Cc: Johan Hedberg, Luiz Augusto von Dentz, David S. Miller,
	Jakub Kicinski, BlueZ, open list:NETWORKING [GENERAL],
	linux-kernel

Hi Soenke,

> msft_find_handle_data returns NULL if it can't find the handle.
> Therefore, handle_data must be checked, otherwise a null pointer
> is dereferenced.
> 
> Signed-off-by: Soenke Huster <soenke.huster@eknoes.de>
> ---
> net/bluetooth/msft.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
> index 484540855863..d2cf92e834f7 100644
> --- a/net/bluetooth/msft.c
> +++ b/net/bluetooth/msft.c
> @@ -705,6 +705,9 @@ static void msft_monitor_device_evt(struct hci_dev *hdev, struct sk_buff *skb)
> 
> 	handle_data = msft_find_handle_data(hdev, ev->monitor_handle, false);
> 

scrap this empty line. The check can got right after the assignment.

> +	if (!handle_data)
> +		return;
> +
> 	switch (ev->addr_type) {
> 	case ADDR_LE_DEV_PUBLIC:
> 		addr_type = BDADDR_LE_PUBLIC;

Regards

Marcel


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

end of thread, other threads:[~2022-01-22 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22  8:27 [PATCH] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt Soenke Huster
2022-01-22  9:04 ` bluez.test.bot
2022-01-22 21:39 ` [PATCH] " Marcel Holtmann

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.