diff mbox series

[v1,1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded

Message ID 1704789450-17754-1-git-send-email-quic_zijuhu@quicinc.com (mailing list archive)
State Accepted
Commit 7974b2128489d062c9d21419633eebde07f07032
Headers show
Series [v1,1/1] Bluetooth: hci_event: Fix wakeup BD_ADDR are wrongly recorded | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse warning CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
tedd_an/CheckSmatch warning CheckSparse WARNING net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

quic_zijuhu Jan. 9, 2024, 8:37 a.m. UTC
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 <quic_zijuhu@quicinc.com>
---
 net/bluetooth/hci_event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Jan. 9, 2024, 9:32 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=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
Paul Menzel Jan. 9, 2024, 9:58 a.m. UTC | #2
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 stable@vger.kernel.org, could you please add a Fixes: tag?

> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
>   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 <pmenzel@molgen.mpg.de>


Kind regards,

Paul
quic_zijuhu Jan. 9, 2024, 10:39 a.m. UTC | #3
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 stable@vger.kernel.org, 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  stable@vger.kernel.org any more.

actually. i just read code and find this issue.

>> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
>> ---
>>   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 <pmenzel@molgen.mpg.de>
> 
> 
> Kind regards,
> 
> Paul
patchwork-bot+bluetooth@kernel.org Jan. 9, 2024, 5 p.m. UTC | #4
Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

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 <quic_zijuhu@quicinc.com>
> 
> [...]

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!
diff mbox series

Patch

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;