2024-01-09 08:42:45

by Zijun Hu

[permalink] [raw]
Subject: [PATCH v1 1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded

hci_store_wake_reason() wrongly parses event HCI_Connection_Request
as HCI_Connection_Complete and HCI_Connection_Complete as
HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
stability issue, it is fixed by this change.

Signed-off-by: Zijun Hu <[email protected]>
---
net/bluetooth/hci_event.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ef8c3bed7361..22b22c264c2a 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -7420,10 +7420,10 @@ static void hci_store_wake_reason(struct hci_dev *hdev, u8 event,
* keep track of the bdaddr of the connection event that woke us up.
*/
if (event == HCI_EV_CONN_REQUEST) {
- bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
+ bacpy(&hdev->wake_addr, &conn_request->bdaddr);
hdev->wake_addr_type = BDADDR_BREDR;
} else if (event == HCI_EV_CONN_COMPLETE) {
- bacpy(&hdev->wake_addr, &conn_request->bdaddr);
+ bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
hdev->wake_addr_type = BDADDR_BREDR;
} else if (event == HCI_EV_LE_META) {
struct hci_ev_le_meta *le_ev = (void *)skb->data;
--
2.7.4



2024-01-09 09:32:55

by bluez.test.bot

[permalink] [raw]
Subject: RE: [v1,1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded

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=815323

---Test result---

Test Summary:
CheckPatch PASS 0.50 seconds
GitLint PASS 0.24 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 28.04 seconds
CheckAllWarning PASS 30.74 seconds
CheckSparse WARNING 36.92 seconds
CheckSmatch WARNING 99.22 seconds
BuildKernel32 PASS 27.10 seconds
TestRunnerSetup PASS 436.36 seconds
TestRunner_l2cap-tester PASS 22.97 seconds
TestRunner_iso-tester PASS 47.10 seconds
TestRunner_bnep-tester PASS 6.76 seconds
TestRunner_mgmt-tester PASS 163.40 seconds
TestRunner_rfcomm-tester PASS 10.85 seconds
TestRunner_sco-tester PASS 14.37 seconds
TestRunner_ioctl-tester PASS 11.93 seconds
TestRunner_mesh-tester PASS 8.86 seconds
TestRunner_smp-tester PASS 9.68 seconds
TestRunner_userchan-tester PASS 7.27 seconds
IncrementalBuild PASS 25.85 seconds

Details
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):


---
Regards,
Linux Bluetooth

2024-01-09 09:59:35

by Paul Menzel

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded

Dear Zijun,


Thank you very much for your patch. Should you resent, some nits for the
commit message. For the summary, I suggest:

Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR

Am 09.01.24 um 09:37 schrieb Zijun Hu:
> hci_store_wake_reason() wrongly parses event HCI_Connection_Request
> as HCI_Connection_Complete and HCI_Connection_Complete as
> HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
> stability issue, it is fixed by this change.

Maybe: … stability issue. Fix it by using the correct field.

How did you reproduce the stability issues?

As you sent it to [email protected], could you please add a Fixes: tag?

> Signed-off-by: Zijun Hu <[email protected]>
> ---
> net/bluetooth/hci_event.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index ef8c3bed7361..22b22c264c2a 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -7420,10 +7420,10 @@ static void hci_store_wake_reason(struct hci_dev *hdev, u8 event,
> * keep track of the bdaddr of the connection event that woke us up.
> */
> if (event == HCI_EV_CONN_REQUEST) {
> - bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
> + bacpy(&hdev->wake_addr, &conn_request->bdaddr);
> hdev->wake_addr_type = BDADDR_BREDR;
> } else if (event == HCI_EV_CONN_COMPLETE) {
> - bacpy(&hdev->wake_addr, &conn_request->bdaddr);
> + bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
> hdev->wake_addr_type = BDADDR_BREDR;
> } else if (event == HCI_EV_LE_META) {
> struct hci_ev_le_meta *le_ev = (void *)skb->data;

Reviewed-by: Paul Menzel <[email protected]>


Kind regards,

Paul

2024-01-09 10:40:37

by Zijun Hu

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded

On 1/9/2024 5:58 PM, Paul Menzel wrote:
> Dear Zijun,
>
>
> Thank you very much for your patch. Should you resent, some nits for the commit message. For the summary, I suggest:
>
> Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR
>
will take your suggestions and send v2 patch
> Am 09.01.24 um 09:37 schrieb Zijun Hu:
>> hci_store_wake_reason() wrongly parses event HCI_Connection_Request
>> as HCI_Connection_Complete and HCI_Connection_Complete as
>> HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
>> stability issue, it is fixed by this change.
>
> Maybe: … stability issue. Fix it by using the correct field.
> will correct commit messages based on your suggestions.
> How did you reproduce the stability issues?
>
> As you sent it to [email protected], could you please add a Fixes: tag?
>
i will take it as potential stability issue since it maybe access unexpected memory area.
don't send it to [email protected] any more.

actually. i just read code and find this issue.

>> Signed-off-by: Zijun Hu <[email protected]>
>> ---
>>   net/bluetooth/hci_event.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
>> index ef8c3bed7361..22b22c264c2a 100644
>> --- a/net/bluetooth/hci_event.c
>> +++ b/net/bluetooth/hci_event.c
>> @@ -7420,10 +7420,10 @@ static void hci_store_wake_reason(struct hci_dev *hdev, u8 event,
>>        * keep track of the bdaddr of the connection event that woke us up.
>>        */
>>       if (event == HCI_EV_CONN_REQUEST) {
>> -        bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
>> +        bacpy(&hdev->wake_addr, &conn_request->bdaddr);
>>           hdev->wake_addr_type = BDADDR_BREDR;
>>       } else if (event == HCI_EV_CONN_COMPLETE) {
>> -        bacpy(&hdev->wake_addr, &conn_request->bdaddr);
>> +        bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
>>           hdev->wake_addr_type = BDADDR_BREDR;
>>       } else if (event == HCI_EV_LE_META) {
>>           struct hci_ev_le_meta *le_ev = (void *)skb->data;
>
> Reviewed-by: Paul Menzel <[email protected]>
>
>
> Kind regards,
>
> Paul


2024-01-09 11:04:09

by Zijun Hu

[permalink] [raw]
Subject: [PATCH v2 1/1] Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR

hci_store_wake_reason() wrongly parses event HCI_Connection_Request
as HCI_Connection_Complete and HCI_Connection_Complete as
HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
potential stability issue, fix it by using the correct field.

Signed-off-by: Zijun Hu <[email protected]>
---
Changes since v1:
- Correct tile and commit message based on Paul's suggestions

net/bluetooth/hci_event.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ef8c3bed7361..22b22c264c2a 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -7420,10 +7420,10 @@ static void hci_store_wake_reason(struct hci_dev *hdev, u8 event,
* keep track of the bdaddr of the connection event that woke us up.
*/
if (event == HCI_EV_CONN_REQUEST) {
- bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
+ bacpy(&hdev->wake_addr, &conn_request->bdaddr);
hdev->wake_addr_type = BDADDR_BREDR;
} else if (event == HCI_EV_CONN_COMPLETE) {
- bacpy(&hdev->wake_addr, &conn_request->bdaddr);
+ bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
hdev->wake_addr_type = BDADDR_BREDR;
} else if (event == HCI_EV_LE_META) {
struct hci_ev_le_meta *le_ev = (void *)skb->data;
--
2.7.4


2024-01-09 11:31:05

by bluez.test.bot

[permalink] [raw]
Subject: RE: [v2,1/1] Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR

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=815358

---Test result---

Test Summary:
CheckPatch PASS 1.10 seconds
GitLint PASS 0.61 seconds
SubjectPrefix PASS 0.14 seconds
BuildKernel PASS 27.62 seconds
CheckAllWarning PASS 30.25 seconds
CheckSparse WARNING 35.68 seconds
CheckSmatch WARNING 98.22 seconds
BuildKernel32 PASS 26.63 seconds
TestRunnerSetup PASS 426.80 seconds
TestRunner_l2cap-tester PASS 22.73 seconds
TestRunner_iso-tester PASS 44.83 seconds
TestRunner_bnep-tester PASS 6.73 seconds
TestRunner_mgmt-tester PASS 160.15 seconds
TestRunner_rfcomm-tester PASS 10.78 seconds
TestRunner_sco-tester PASS 14.29 seconds
TestRunner_ioctl-tester PASS 11.87 seconds
TestRunner_mesh-tester PASS 8.68 seconds
TestRunner_smp-tester PASS 9.63 seconds
TestRunner_userchan-tester PASS 7.19 seconds
IncrementalBuild PASS 25.91 seconds

Details
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):


---
Regards,
Linux Bluetooth

2024-01-09 17:00:40

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Tue, 9 Jan 2024 19:03:23 +0800 you wrote:
> hci_store_wake_reason() wrongly parses event HCI_Connection_Request
> as HCI_Connection_Complete and HCI_Connection_Complete as
> HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
> potential stability issue, fix it by using the correct field.
>
> Signed-off-by: Zijun Hu <[email protected]>
>
> [...]

Here is the summary with links:
- [v2,1/1] Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR
https://git.kernel.org/bluetooth/bluetooth-next/c/7974b2128489

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2024-01-09 17:01:33

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Tue, 9 Jan 2024 16:37:30 +0800 you wrote:
> hci_store_wake_reason() wrongly parses event HCI_Connection_Request
> as HCI_Connection_Complete and HCI_Connection_Complete as
> HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
> stability issue, it is fixed by this change.
>
> Signed-off-by: Zijun Hu <[email protected]>
>
> [...]

Here is the summary with links:
- [v1,1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded
https://git.kernel.org/bluetooth/bluetooth-next/c/7974b2128489

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html