Skip to contentSkip to conversation

Bluetooth : Fix hci_sync miss wakeup interrupt

RFC 박찬열 3 participants 3 messages Oct 22, 2014 – Oct 31, 2014 Bluetooth drivers

lore
Share & tools
lore

박찬열

author
#0 lore raw

DQpfX2hjaV9jbWRfc3luY19ldigpLCBfX2hjaV9yZXFfc3luYygpIGNvdWxkIG1pc3Mgd2FrZV91 cF9pbnRlcnJ1cHQgZnJvbQ0KaGNpX3JlcV9zeW5jX2NvbXBsZXRlKCkgYmVjYXVzZSBoY2lfY21k X3dvcmsoKSB3b3JrcXVlZSBhbmQgaXRzIHJlcG9uc2UNCmNvdWxkIGJlIGNvbXBsZXRlZCBiZWZv cmUgdGhleSBhcmUgcmVhZHkgdG8gZ2V0IHRoZSBzaWduYWwgdGhyb3VnaA0KYWRkX3dhaXRfcXVl dWUoKSwgc2V0X2N1cnJlbnRfc3RhdGUoVEFTS19JTlRFUlJVUFRJQkxFKS4NCg0KU2lnbmVkLW9m Zi1ieTogQ2hhbi15ZW9sIFBhcmsgPGNoYW55ZW9sLnBhcmtAc2Ftc3VuZy5jb20+DQpTaWduZWQt b2ZmLWJ5OiBLeXVuZ21pbiBQYXJrIDxreXVuZ21pbi5wYXJrQHNhbXN1bmcuY29tPg0KLS0tDQog bmV0L2JsdWV0b290aC9oY2lfY29yZS5jIHwgMTggKysrKysrKysrKystLS0tLS0tDQogMSBmaWxl IGNoYW5nZWQsIDExIGluc2VydGlvbnMoKyksIDcgZGVsZXRpb25zKC0pDQoNCmRpZmYgLS1naXQg YS9uZXQvYmx1ZXRvb3RoL2hjaV9jb3JlLmMgYi9uZXQvYmx1ZXRvb3RoL2hjaV9jb3JlLmMNCmlu ZGV4IGNiMDVkN2YuLmMwMDhmMWYgMTAwNjQ0DQotLS0gYS9uZXQvYmx1ZXRvb3RoL2hjaV9jb3Jl LmMNCisrKyBiL25ldC9ibHVldG9vdGgvaGNpX2NvcmUuYw0KQEAgLTExNDcsMTMgKzExNDcsMTUg QEAgc3RydWN0IHNrX2J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NCiAgICAgICAgZXJyID0g aGNpX3JlcV9ydW4oJnJlcSwgaGNpX3JlcV9zeW5jX2NvbXBsZXRlKTsNCiAgICAgICAgaWYgKGVy ciA8IDApIHsNCiAgICAgICAgICAgICAgICBoZGV2LT5yZXFfc3RhdHVzID0gMDsNCg0KKyAgICAg ICAgICAgICAgIHJlbW92ZV93YWl0X3F1ZXVlKCZoZGV2LT5yZXFfd2FpdF9xLCAmd2FpdCk7DQor DQogICAgICAgICAgICAgICAgLyogRU5PREFUQSBtZWFucyB0aGUgSENJIHJlcXVlc3QgY29tbWFu ZCBxdWV1ZSBpcyBlbXB0eS4NCiAgICAgICAgICAgICAgICAgKiBUaGlzIGNhbiBoYXBwZW4gd2hl biBhIHJlcXVlc3Qgd2l0aCBjb25kaXRpb25hbHMgZG9lc24ndA0KICAgICAgICAgICAgICAgICAq IHRyaWdnZXIgYW55IGNvbW1hbmRzIHRvIGJlIHNlbnQuIFRoaXMgaXMgbm9ybWFsIGJlaGF2aW9y DQpAQCAtMTIyNiw5ICsxMjMzLDYgQEAgc3RhdGljIGludCBfX2hjaV9yZXFfc3luYyhzdHJ1Y3Qg aGNpX2RldiAqaGRldiwNCiAgICAgICAgICAgICAgICByZXR1cm4gZXJyOw0KICAgICAgICB9DQoN Ci0gICAgICAgYWRkX3dhaXRfcXVldWUoJmhkZXYtPnJlcV93YWl0X3EsICZ3YWl0KTsNCi0gICAg ICAgc2V0X2N1cnJlbnRfc3RhdGUoVEFTS19JTlRFUlJVUFRJQkxFKTsNCi0NCiAgICAgICAgc2No ZWR1bGVfdGltZW91dCh0aW1lb3V0KTsNCg0KICAgICAgICByZW1vdmVfd2FpdF9xdWV1ZSgmaGRl di0+cmVxX3dhaXRfcSwgJndhaXQpOw0KLS0NCjEuOS4xIA0KICAgICAgIA0KDQogIA0KDQogICAg ICAgICANCiAgDQo=

maintainer
#1 lore raw

Hi Chan-yeol,

Quoted 16 lines

__hci_cmd_sync_ev(), __hci_req_sync() could miss wake_up_interrupt from hci_req_sync_complete() because hci_cmd_work() workquee and its reponse could be completed before they are ready to get the signal through add_wait_queue(), set_current_state(TASK_INTERRUPTIBLE).

---
net/bluetooth/hci_core.c | 18 +++++++++++-------

1 file changed, 11 insertions(+), 7 deletions(-)
net/bluetooth/hci_core.c +0 -0
index cb05d7f..c008f1f 100644

net/bluetooth/hci_core.c struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, · line 1153

Quoted 7 lines
net/bluetooth/hci_core.c +0 -4
@@ -1147,13 +1147,15 @@ struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
 
       hdev->req_status = HCI_REQ_PEND;
 
-       err = hci_req_run(&req, hci_req_sync_complete);
-       if (err < 0)
-               return ERR_PTR(err);
-

the whole patch has whitespace damages. Please fix this.

Regards

Marcel

#2 lore raw

Hi Marcel

Due to internal reason I made mistake.

I raised it again.

Thanks
Chanyeol
2014. 10. 29. 오전 2:32에 "Marcel Holtmann" <[email protected]>님이 작성:

Quoted 39 lines

Hi Chan-yeol,

net/bluetooth/hci_core.c struct sk_buff *__hci_cmd_sync_ev(struct hci_dev

Quoted 16 lines

__hci_cmd_sync_ev(), __hci_req_sync() could miss wake_up_interrupt from hci_req_sync_complete() because hci_cmd_work() workquee and its reponse could be completed before they are ready to get the signal through add_wait_queue(), set_current_state(TASK_INTERRUPTIBLE).

---
net/bluetooth/hci_core.c | 18 +++++++++++-------

1 file changed, 11 insertions(+), 7 deletions(-)
net/bluetooth/hci_core.c +0 -0
index cb05d7f..c008f1f 100644
@@ -1147,13 +1147,15 @@ struct sk_buff *__hci_cmd_sync_ev(struct hci_dev

*hdev, u16 opcode, u32 plen,

net/bluetooth/hci_core.c struct sk_buff *__hci_cmd_sync_ev(struct hci_dev · line 1152

Quoted 7 lines
net/bluetooth/hci_core.c +0 -4
       hdev->req_status = HCI_REQ_PEND;
 
-       err = hci_req_run(&req, hci_req_sync_complete);
-       if (err < 0)
-               return ERR_PTR(err);
-

the whole patch has whitespace damages. Please fix this.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html