Bluetooth: Fix removing connection parameters when unpairing
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 19 Oct 2015 07:51:47 +0000 (10:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Dec 2015 19:03:21 +0000 (14:03 -0500)
commitd4815c10674240ee535ddcb19c408ba13102d9e6
treedc9939b6be4db8d9a40cdbec2650c6119f7236bf
parenta1475c6b60a079251d440140bb51fb6ddf1a5a6e
Bluetooth: Fix removing connection parameters when unpairing

commit a6ad2a6b9cc1d9d791aee5462cfb8528f366f1d4 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/bluetooth/mgmt.c