Bluetooth: Fix not generating RPA when required
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 2 Aug 2021 23:56:19 +0000 (16:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:42:07 +0000 (13:42 +0200)
commit20b3c266e9d5f51799ffcb6865f991a875a78414
tree4295178bc8aaec7176cf90ced70e1e41cece3f6a
parentf38dd8ef3074c3dc83031fcc3f0f0f437ac7f0f3
Bluetooth: Fix not generating RPA when required

[ Upstream commit c45074d68a9b1e893d86520af71fab37693c3d7e ]

Code was checking if random_addr and hdev->rpa match without first
checking if the RPA has not been set (BDADDR_ANY), furthermore it was
clearing HCI_RPA_EXPIRED before the command completes and the RPA is
actually programmed which in case of failure would leave the expired
RPA still set.

Since advertising instance have a similar problem the clearing of
HCI_RPA_EXPIRED has been moved to hci_event.c after checking the random
address is in fact the hdev->rap and then proceed to set the expire
timeout.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c
net/bluetooth/hci_request.c