aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-10-19 03:51:47 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-10-20 18:49:24 -0400
commita6ad2a6b9cc1d9d791aee5462cfb8528f366f1d4 (patch)
treedf2ca523b2634275a473db7f2ca6a3d4066f2899
parent22f8e9dbf671a2f36d90d3d8723a2a0c5227fa4b (diff)
Bluetooth: Fix removing connection parameters when unpairing
The commit 89cbb0638e9b7 introduced support for deferred connection parameter removal when unpairing by removing them only once an existing connection gets disconnected. However, it failed to address the scenario when we're *not* connected and do an unpair operation. What makes things worse is that most user space BlueZ versions will first issue a disconnect request and only then unpair, meaning the buggy code will be triggered every time. This effectively causes the kernel to resume scanning and reconnect to a device for which we've removed all keys and GATT database information. This patch fixes the issue by adding the missing call to the hci_conn_params_del() function to a branch which handles the case of no existing connection. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Cc: stable@vger.kernel.org # 3.19+
-rw-r--r--net/bluetooth/mgmt.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 33a8564397b4..98d8d20a05c1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3090,6 +3090,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3090 } else { 3090 } else {
3091 u8 addr_type; 3091 u8 addr_type;
3092 3092
3093 if (cp->addr.type == BDADDR_LE_PUBLIC)
3094 addr_type = ADDR_LE_DEV_PUBLIC;
3095 else
3096 addr_type = ADDR_LE_DEV_RANDOM;
3097
3093 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, 3098 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK,
3094 &cp->addr.bdaddr); 3099 &cp->addr.bdaddr);
3095 if (conn) { 3100 if (conn) {
@@ -3105,13 +3110,10 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
3105 */ 3110 */
3106 if (!cp->disconnect) 3111 if (!cp->disconnect)
3107 conn = NULL; 3112 conn = NULL;
3113 } else {
3114 hci_conn_params_del(hdev, &cp->addr.bdaddr, addr_type);
3108 } 3115 }
3109 3116
3110 if (cp->addr.type == BDADDR_LE_PUBLIC)
3111 addr_type = ADDR_LE_DEV_PUBLIC;
3112 else
3113 addr_type = ADDR_LE_DEV_RANDOM;
3114
3115 hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type); 3117 hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type);
3116 3118
3117 err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type); 3119 err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type);