* [kernel PATCH v2 0/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
@ 2022-08-23 4:44 Zhengping Jiang
2022-08-23 4:44 ` [kernel PATCH v2 1/1] " Zhengping Jiang
0 siblings, 1 reply; 5+ messages in thread
From: Zhengping Jiang @ 2022-08-23 4:44 UTC (permalink / raw)
To: linux-bluetooth, marcel
Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johan Hedberg,
Luiz Augusto von Dentz, Paolo Abeni, linux-kernel, netdev
Hold hdev->lock for hci_conn_failed. There are possible race conditions
which may cause kernel crash.
Changes in v2:
- Update commit message
Changes in v1:
- Hold hdev->lock for hci_conn_failed
Zhengping Jiang (1):
Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
net/bluetooth/hci_sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--
2.37.1.595.g718a3a8f04-goog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [kernel PATCH v2 1/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
2022-08-23 4:44 [kernel PATCH v2 0/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn Zhengping Jiang
@ 2022-08-23 4:44 ` Zhengping Jiang
2022-08-23 5:25 ` bluez.test.bot
2022-08-23 11:06 ` [kernel PATCH v2 1/1] " Paolo Abeni
0 siblings, 2 replies; 5+ messages in thread
From: Zhengping Jiang @ 2022-08-23 4:44 UTC (permalink / raw)
To: linux-bluetooth, marcel
Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johan Hedberg,
Luiz Augusto von Dentz, Paolo Abeni, linux-kernel, netdev
When disconnecting all devices, hci_conn_failed is used to cleanup
hci_conn object when the hci_conn object cannot be aborted.
The function hci_conn_failed requires the caller holds hdev->lock.
Fixes: 9b3628d79b46f ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted")
Signed-off-by: Zhengping Jiang <jiangzp@google.com>
---
Changes in v2:
- Update commit message
Changes in v1:
- Hold hdev->lock for hci_conn_failed
net/bluetooth/hci_sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 74a0cd5d0b37f..e08c0503027d8 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5034,9 +5034,11 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason)
/* Cleanup hci_conn object if it cannot be cancelled as it
* likelly means the controller and host stack are out of sync.
*/
- if (err)
+ if (err) {
+ hci_dev_lock(hdev);
hci_conn_failed(conn, err);
-
+ hci_dev_unlock(hdev);
+ }
return err;
case BT_CONNECT2:
return hci_reject_conn_sync(hdev, conn, reason);
--
2.37.1.595.g718a3a8f04-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
2022-08-23 4:44 ` [kernel PATCH v2 1/1] " Zhengping Jiang
@ 2022-08-23 5:25 ` bluez.test.bot
2022-08-23 11:06 ` [kernel PATCH v2 1/1] " Paolo Abeni
1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-08-23 5:25 UTC (permalink / raw)
To: linux-bluetooth, jiangzp
[-- Attachment #1: Type: text/plain, Size: 1096 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=670006
---Test result---
Test Summary:
CheckPatch PASS 1.62 seconds
GitLint PASS 0.95 seconds
SubjectPrefix PASS 0.64 seconds
BuildKernel PASS 34.08 seconds
BuildKernel32 PASS 28.82 seconds
Incremental Build with patchesPASS 41.42 seconds
TestRunner: Setup PASS 479.01 seconds
TestRunner: l2cap-tester PASS 16.64 seconds
TestRunner: bnep-tester PASS 6.27 seconds
TestRunner: mgmt-tester PASS 99.95 seconds
TestRunner: rfcomm-tester PASS 9.53 seconds
TestRunner: sco-tester PASS 9.30 seconds
TestRunner: smp-tester PASS 9.30 seconds
TestRunner: userchan-tester PASS 6.39 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kernel PATCH v2 1/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
2022-08-23 4:44 ` [kernel PATCH v2 1/1] " Zhengping Jiang
2022-08-23 5:25 ` bluez.test.bot
@ 2022-08-23 11:06 ` Paolo Abeni
1 sibling, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2022-08-23 11:06 UTC (permalink / raw)
To: Zhengping Jiang, linux-bluetooth, marcel
Cc: chromeos-bluetooth-upstreaming, David S. Miller, Eric Dumazet,
Jakub Kicinski, Johan Hedberg, Luiz Augusto von Dentz,
linux-kernel, netdev
On Mon, 2022-08-22 at 21:44 -0700, Zhengping Jiang wrote:
> When disconnecting all devices, hci_conn_failed is used to cleanup
> hci_conn object when the hci_conn object cannot be aborted.
> The function hci_conn_failed requires the caller holds hdev->lock.
>
> Fixes: 9b3628d79b46f ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted")
>
> Signed-off-by: Zhengping Jiang <jiangzp@google.com>
For the records, you should avoid empty lines between the 'fixes' tag
and your SoB.
Cheers,
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [kernel PATCH v3 1/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
@ 2022-08-23 17:28 Zhengping Jiang
2022-08-23 19:59 ` bluez.test.bot
0 siblings, 1 reply; 5+ messages in thread
From: Zhengping Jiang @ 2022-08-23 17:28 UTC (permalink / raw)
To: linux-bluetooth, marcel
Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johan Hedberg,
Luiz Augusto von Dentz, Paolo Abeni, linux-kernel, netdev
When disconnecting all devices, hci_conn_failed is used to cleanup
hci_conn object when the hci_conn object cannot be aborted.
The function hci_conn_failed requires the caller holds hdev->lock.
Fixes: 9b3628d79b46f ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted")
Signed-off-by: Zhengping Jiang <jiangzp@google.com>
---
Changes in v3:
- Remove an empty line in commit message between Fixes and SoB
Changes in v2:
- Update commit message
Changes in v1:
- Hold hdev->lock for hci_conn_failed
net/bluetooth/hci_sync.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 74a0cd5d0b37f..e08c0503027d8 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -5034,9 +5034,11 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason)
/* Cleanup hci_conn object if it cannot be cancelled as it
* likelly means the controller and host stack are out of sync.
*/
- if (err)
+ if (err) {
+ hci_dev_lock(hdev);
hci_conn_failed(conn, err);
-
+ hci_dev_unlock(hdev);
+ }
return err;
case BT_CONNECT2:
return hci_reject_conn_sync(hdev, conn, reason);
--
2.37.1.595.g718a3a8f04-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
2022-08-23 17:28 [kernel PATCH v3 " Zhengping Jiang
@ 2022-08-23 19:59 ` bluez.test.bot
0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2022-08-23 19:59 UTC (permalink / raw)
To: linux-bluetooth, jiangzp
[-- Attachment #1: Type: text/plain, Size: 1100 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=670367
---Test result---
Test Summary:
CheckPatch PASS 0.90 seconds
GitLint PASS 0.50 seconds
SubjectPrefix PASS 0.31 seconds
BuildKernel PASS 41.03 seconds
BuildKernel32 PASS 37.01 seconds
Incremental Build with patchesPASS 52.46 seconds
TestRunner: Setup PASS 590.16 seconds
TestRunner: l2cap-tester PASS 19.08 seconds
TestRunner: bnep-tester PASS 7.51 seconds
TestRunner: mgmt-tester PASS 122.65 seconds
TestRunner: rfcomm-tester PASS 12.16 seconds
TestRunner: sco-tester PASS 11.78 seconds
TestRunner: smp-tester PASS 11.16 seconds
TestRunner: userchan-tester PASS 7.64 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-23 20:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 4:44 [kernel PATCH v2 0/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn Zhengping Jiang
2022-08-23 4:44 ` [kernel PATCH v2 1/1] " Zhengping Jiang
2022-08-23 5:25 ` bluez.test.bot
2022-08-23 11:06 ` [kernel PATCH v2 1/1] " Paolo Abeni
-- strict thread matches above, loose matches on Subject: below --
2022-08-23 17:28 [kernel PATCH v3 " Zhengping Jiang
2022-08-23 19:59 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox