diff mbox series

[v2] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt

Message ID 20220123055709.7925-1-soenke.huster@eknoes.de
State New
Headers show
Series [v2] Bluetooth: msft: fix null pointer deref on msft_monitor_device_evt | expand

Commit Message

Soenke Huster Jan. 23, 2022, 5:57 a.m. UTC
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>
---
v2: Remove empty line

 net/bluetooth/msft.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

bluez.test.bot@gmail.com Jan. 23, 2022, 7:04 a.m. UTC | #1
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=607542

---Test result---

Test Summary:
CheckPatch                    PASS      1.55 seconds
GitLint                       PASS      1.03 seconds
SubjectPrefix                 PASS      0.85 seconds
BuildKernel                   PASS      29.25 seconds
BuildKernel32                 PASS      25.92 seconds
Incremental Build with patchesPASS      35.97 seconds
TestRunner: Setup             PASS      464.06 seconds
TestRunner: l2cap-tester      PASS      13.32 seconds
TestRunner: bnep-tester       PASS      6.07 seconds
TestRunner: mgmt-tester       PASS      102.13 seconds
TestRunner: rfcomm-tester     PASS      7.36 seconds
TestRunner: sco-tester        PASS      7.57 seconds
TestRunner: smp-tester        PASS      7.42 seconds
TestRunner: userchan-tester   PASS      6.28 seconds



---
Regards,
Linux Bluetooth
Marcel Holtmann Jan. 23, 2022, 2:30 p.m. UTC | #2
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>
> ---
> v2: Remove empty line
> 
> net/bluetooth/msft.c | 2 ++
> 1 file changed, 2 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

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