aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-10-28 17:23:27 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-28 17:48:56 -0400
commit0b1db38ca26b322296cbd141f3080eccfe1cc3e1 (patch)
treea75be64acc44c0dc2928d3dbbb7eebd988987995 /net/bluetooth/hci_conn.c
parent980ffc0a2cec2c37589cc97993e1ad17252f4f47 (diff)
Bluetooth: Fix check for direct advertising
These days we allow simultaneous LE scanning and advertising. Checking for whether advertising is enabled or not is therefore not a reliable way to determine whether directed advertising was used to trigger the connection creation. The appropriate place to check (instead of the hdev context) is the connection role that's stored in the hci_conn. This patch fixes such a check in le_conn_timeout() which could otherwise lead to incorrect HCI commands being sent. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Cc: stable@vger.kernel.org # 3.16.x
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 74b8e2421e96..96887ae8375b 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -416,7 +416,7 @@ static void le_conn_timeout(struct work_struct *work)
416 * happen with broken hardware or if low duty cycle was used 416 * happen with broken hardware or if low duty cycle was used
417 * (which doesn't have a timeout of its own). 417 * (which doesn't have a timeout of its own).
418 */ 418 */
419 if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) { 419 if (conn->role == HCI_ROLE_SLAVE) {
420 u8 enable = 0x00; 420 u8 enable = 0x00;
421 hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable), 421 hci_send_cmd(hdev, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
422 &enable); 422 &enable);