]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Fix disconnecting connections in non-connected states
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 27 Feb 2014 12:35:12 +0000 (14:35 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 28 Feb 2014 07:35:08 +0000 (23:35 -0800)
commitb270e8eca1b4389e1131bc7787daa5c0030e7b74
treed25368485680682de3561753c394fdb2cffb92d3
parent3427e69fe4e45721b8e0785ff0fa95a9d278b988
Bluetooth: Fix disconnecting connections in non-connected states

When powering off and disconnecting devices we should also consider
connections which have not yet reached the BT_CONNECTED state. They may
not have a valid handle yet and simply sending a HCI_Disconnect will not
work.

This patch updates the code to either disconnect, cancel connection
creation or reject incoming connection creation based on the current
conn->state value as well as the link type in question.

When the power off procedure results in canceling connection attempts
instead of disconnecting connections we get a connection failed event
instead of a disconnection event. Therefore, we also need to have extra
code in the mgmt_connect_failed function to check if we should proceed
with the power off or not.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c