]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb
authorDouglas Anderson <dianders@chromium.org>
Fri, 19 Feb 2016 22:25:21 +0000 (14:25 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 20 Feb 2016 07:52:28 +0000 (08:52 +0100)
commitae53c8303526167f7c5cf1056f9bc1ee834966f7
tree13d778f68c03381a1a54bdc31fb454adbff66c0d
parentc294523e6f68cb3b9ddce44e653ac05ecefcfbbf
Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb

In commit dd24e9e91d7f ("Bluetooth: Compress the size of struct
hci_ctrl") we squashed down the size of the structure by using a union
with the assumption that all users would use the flag to determine
whether we had a req_complete or a req_complete_skb.

Unfortunately we had a case in hci_req_cmd_complete() where we weren't
looking at the flag.  This can result in a situation where we might be
storing a hci_req_complete_skb_t in a hci_req_complete_t variable, or
vice versa.

During some testing I found at least one case where the function
hci_req_sync_complete() was called improperly because the kernel thought
that it didn't require an SKB.  Looking through the stack in kgdb I
found that it was called by hci_event_packet() and that
hci_event_packet() had both of its locals "req_complete" and
"req_complete_skb" pointing to the same place: both to
hci_req_sync_complete().

Let's make sure we always check the flag.

For more details on debugging done, see <http://crbug.com/588288>.

Fixes: dd24e9e91d7f ("Bluetooth: Compress the size of struct hci_ctrl")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_core.c