Commit 8be964d2364e8fbe302850f60d9d514c3e134510
Committed by
Gustavo F. Padovan
1 parent
2d20a26a92
Exists in
master
and in
4 other branches
Bluetooth: Fixed BT ST Channel reg order
Reordered the BT ST channel registration, to make sure that the event channel is registered before all others. This prevents a situation where incoming events may cause kernel panic in the ST driver if the event channel is not yet registered to handle incoming events.In addition, the deregistration of the channels was also modified, to be in the reversed order of the registration, to allow the event channel to be the last one unregistered. Signed-off-by: Chen Ganir <chen.ganir@ti.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff
drivers/bluetooth/btwilink.c
... | ... | @@ -125,6 +125,13 @@ |
125 | 125 | /* protocol structure registered with shared transport */ |
126 | 126 | static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = { |
127 | 127 | { |
128 | + .chnl_id = HCI_EVENT_PKT, /* HCI Events */ | |
129 | + .hdr_len = sizeof(struct hci_event_hdr), | |
130 | + .offset_len_in_hdr = offsetof(struct hci_event_hdr, plen), | |
131 | + .len_size = 1, /* sizeof(plen) in struct hci_event_hdr */ | |
132 | + .reserve = 8, | |
133 | + }, | |
134 | + { | |
128 | 135 | .chnl_id = HCI_ACLDATA_PKT, /* ACL */ |
129 | 136 | .hdr_len = sizeof(struct hci_acl_hdr), |
130 | 137 | .offset_len_in_hdr = offsetof(struct hci_acl_hdr, dlen), |
... | ... | @@ -138,13 +145,6 @@ |
138 | 145 | .len_size = 1, /* sizeof(dlen) in struct hci_sco_hdr */ |
139 | 146 | .reserve = 8, |
140 | 147 | }, |
141 | - { | |
142 | - .chnl_id = HCI_EVENT_PKT, /* HCI Events */ | |
143 | - .hdr_len = sizeof(struct hci_event_hdr), | |
144 | - .offset_len_in_hdr = offsetof(struct hci_event_hdr, plen), | |
145 | - .len_size = 1, /* sizeof(plen) in struct hci_event_hdr */ | |
146 | - .reserve = 8, | |
147 | - }, | |
148 | 148 | }; |
149 | 149 | |
150 | 150 | /* Called from HCI core to initialize the device */ |
... | ... | @@ -240,7 +240,7 @@ |
240 | 240 | if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) |
241 | 241 | return 0; |
242 | 242 | |
243 | - for (i = 0; i < MAX_BT_CHNL_IDS; i++) { | |
243 | + for (i = MAX_BT_CHNL_IDS-1; i >= 0; i--) { | |
244 | 244 | err = st_unregister(&ti_st_proto[i]); |
245 | 245 | if (err) |
246 | 246 | BT_ERR("st_unregister(%d) failed with error %d", |