linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
@ 2021-02-02  9:42 Gopal Tiwari
  2021-02-02 10:18 ` bluez.test.bot
  2021-02-02 16:23 ` [PATCH] " Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Gopal Tiwari @ 2021-02-02  9:42 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz, johan.hedberg, marcel; +Cc: gtiwari

kernel panic trace looks like: 

 #5 [ffffb9e08698fc80] do_page_fault at ffffffffb666e0d7
 #6 [ffffb9e08698fcb0] page_fault at ffffffffb70010fe
    [exception RIP: amp_read_loc_assoc_final_data+63]
    RIP: ffffffffc06ab54f  RSP: ffffb9e08698fd68  RFLAGS: 00010246
    RAX: 0000000000000000  RBX: ffff8c8845a5a000  RCX: 0000000000000004
    RDX: 0000000000000000  RSI: ffff8c8b9153d000  RDI: ffff8c8845a5a000
    RBP: ffffb9e08698fe40   R8: 00000000000330e0   R9: ffffffffc0675c94
    R10: ffffb9e08698fe58  R11: 0000000000000001  R12: ffff8c8b9cbf6200
    R13: 0000000000000000  R14: 0000000000000000  R15: ffff8c8b2026da0b
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #7 [ffffb9e08698fda8] hci_event_packet at ffffffffc0676904 [bluetooth]
 #8 [ffffb9e08698fe50] hci_rx_work at ffffffffc06629ac [bluetooth]
 #9 [ffffb9e08698fe98] process_one_work at ffffffffb66f95e7

hcon->amp_mgr seems NULL triggered kernel panic in following line inside
function amp_read_loc_assoc_final_data

        set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state);

Fixed by checking NULL for mgr.

Signed-off-by: Gopal Tiwari <gtiwari@redhat.com>
---
 net/bluetooth/amp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 9c711f0dfae3..be2d469d6369 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -297,6 +297,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
 	struct hci_request req;
 	int err;
 
+	if (!mgr)
+		return;
+
 	cp.phy_handle = hcon->handle;
 	cp.len_so_far = cpu_to_le16(0);
 	cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
-- 
2.21.1


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

* RE: Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
  2021-02-02  9:42 [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data Gopal Tiwari
@ 2021-02-02 10:18 ` bluez.test.bot
  2021-02-02 16:23 ` [PATCH] " Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2021-02-02 10:18 UTC (permalink / raw)
  To: linux-bluetooth, gtiwari

[-- Attachment #1: Type: text/plain, Size: 1599 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=426065

---Test result---

##############################
    Test: CheckPatch - PASS
    

    ##############################
    Test: CheckGitLint - PASS
    

    ##############################
    Test: CheckBuildK - PASS
    

    ##############################
    Test: CheckTestRunner: Setup - PASS
    

    ##############################
    Test: CheckTestRunner: l2cap-tester - PASS
    Total: 40, Passed: 34 (85.0%), Failed: 0, Not Run: 6

    ##############################
    Test: CheckTestRunner: bnep-tester - PASS
    Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

    ##############################
    Test: CheckTestRunner: mgmt-tester - PASS
    Total: 416, Passed: 400 (96.2%), Failed: 0, Not Run: 16

    ##############################
    Test: CheckTestRunner: rfcomm-tester - PASS
    Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

    ##############################
    Test: CheckTestRunner: sco-tester - PASS
    Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

    ##############################
    Test: CheckTestRunner: smp-tester - PASS
    Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

    ##############################
    Test: CheckTestRunner: userchan-tester - PASS
    Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0

    

---
Regards,
Linux Bluetooth


[-- Attachment #2: l2cap-tester.log --]
[-- Type: application/octet-stream, Size: 43341 bytes --]

[-- Attachment #3: bnep-tester.log --]
[-- Type: application/octet-stream, Size: 3532 bytes --]

[-- Attachment #4: mgmt-tester.log --]
[-- Type: application/octet-stream, Size: 546229 bytes --]

[-- Attachment #5: rfcomm-tester.log --]
[-- Type: application/octet-stream, Size: 11652 bytes --]

[-- Attachment #6: sco-tester.log --]
[-- Type: application/octet-stream, Size: 9886 bytes --]

[-- Attachment #7: smp-tester.log --]
[-- Type: application/octet-stream, Size: 11798 bytes --]

[-- Attachment #8: userchan-tester.log --]
[-- Type: application/octet-stream, Size: 5429 bytes --]

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

* Re: [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
  2021-02-02  9:42 [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data Gopal Tiwari
  2021-02-02 10:18 ` bluez.test.bot
@ 2021-02-02 16:23 ` Marcel Holtmann
  2021-02-02 16:48   ` Gopal Tiwari
  1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2021-02-02 16:23 UTC (permalink / raw)
  To: Gopal Tiwari
  Cc: Bluetooth Kernel Mailing List, Luiz Augusto von Dentz, Johan Hedberg

Hi Gopal,

> kernel panic trace looks like: 
> 
> #5 [ffffb9e08698fc80] do_page_fault at ffffffffb666e0d7
> #6 [ffffb9e08698fcb0] page_fault at ffffffffb70010fe
>    [exception RIP: amp_read_loc_assoc_final_data+63]
>    RIP: ffffffffc06ab54f  RSP: ffffb9e08698fd68  RFLAGS: 00010246
>    RAX: 0000000000000000  RBX: ffff8c8845a5a000  RCX: 0000000000000004
>    RDX: 0000000000000000  RSI: ffff8c8b9153d000  RDI: ffff8c8845a5a000
>    RBP: ffffb9e08698fe40   R8: 00000000000330e0   R9: ffffffffc0675c94
>    R10: ffffb9e08698fe58  R11: 0000000000000001  R12: ffff8c8b9cbf6200
>    R13: 0000000000000000  R14: 0000000000000000  R15: ffff8c8b2026da0b
>    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
> #7 [ffffb9e08698fda8] hci_event_packet at ffffffffc0676904 [bluetooth]
> #8 [ffffb9e08698fe50] hci_rx_work at ffffffffc06629ac [bluetooth]
> #9 [ffffb9e08698fe98] process_one_work at ffffffffb66f95e7
> 
> hcon->amp_mgr seems NULL triggered kernel panic in following line inside
> function amp_read_loc_assoc_final_data
> 
>        set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state);
> 
> Fixed by checking NULL for mgr.
> 
> Signed-off-by: Gopal Tiwari <gtiwari@redhat.com>
> ---
> net/bluetooth/amp.c | 3 +++
> 1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
  2021-02-02 16:23 ` [PATCH] " Marcel Holtmann
@ 2021-02-02 16:48   ` Gopal Tiwari
  0 siblings, 0 replies; 4+ messages in thread
From: Gopal Tiwari @ 2021-02-02 16:48 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Bluetooth Kernel Mailing List, Luiz Augusto von Dentz, Johan Hedberg

Thanks Marcel.

Regards,
Gopal 

----- Original Message -----
From: "Marcel Holtmann" <marcel@holtmann.org>
To: "Gopal Tiwari" <gtiwari@redhat.com>
Cc: "Bluetooth Kernel Mailing List" <linux-bluetooth@vger.kernel.org>, "Luiz Augusto von Dentz" <luiz.dentz@gmail.com>, "Johan Hedberg" <johan.hedberg@gmail.com>
Sent: Tuesday, February 2, 2021 9:53:57 PM
Subject: Re: [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data

Hi Gopal,

> kernel panic trace looks like: 
> 
> #5 [ffffb9e08698fc80] do_page_fault at ffffffffb666e0d7
> #6 [ffffb9e08698fcb0] page_fault at ffffffffb70010fe
>    [exception RIP: amp_read_loc_assoc_final_data+63]
>    RIP: ffffffffc06ab54f  RSP: ffffb9e08698fd68  RFLAGS: 00010246
>    RAX: 0000000000000000  RBX: ffff8c8845a5a000  RCX: 0000000000000004
>    RDX: 0000000000000000  RSI: ffff8c8b9153d000  RDI: ffff8c8845a5a000
>    RBP: ffffb9e08698fe40   R8: 00000000000330e0   R9: ffffffffc0675c94
>    R10: ffffb9e08698fe58  R11: 0000000000000001  R12: ffff8c8b9cbf6200
>    R13: 0000000000000000  R14: 0000000000000000  R15: ffff8c8b2026da0b
>    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
> #7 [ffffb9e08698fda8] hci_event_packet at ffffffffc0676904 [bluetooth]
> #8 [ffffb9e08698fe50] hci_rx_work at ffffffffc06629ac [bluetooth]
> #9 [ffffb9e08698fe98] process_one_work at ffffffffb66f95e7
> 
> hcon->amp_mgr seems NULL triggered kernel panic in following line inside
> function amp_read_loc_assoc_final_data
> 
>        set_bit(READ_LOC_AMP_ASSOC_FINAL, &mgr->state);
> 
> Fixed by checking NULL for mgr.
> 
> Signed-off-by: Gopal Tiwari <gtiwari@redhat.com>
> ---
> net/bluetooth/amp.c | 3 +++
> 1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2021-02-02 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  9:42 [PATCH] Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data Gopal Tiwari
2021-02-02 10:18 ` bluez.test.bot
2021-02-02 16:23 ` [PATCH] " Marcel Holtmann
2021-02-02 16:48   ` Gopal Tiwari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).