From: Johan Hedberg Date: Fri, 8 Aug 2014 06:32:48 +0000 (+0300) Subject: Bluetooth: Fix hci_update_random_address() error return for no crypto X-Git-Tag: v5.15~17047^2~133^2~84^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fabed38fcf456cc5d3e6946fab78855aa65bd40b;p=platform%2Fkernel%2Flinux-starfive.git Bluetooth: Fix hci_update_random_address() error return for no crypto If the AES crypto context is not available we cannot generate new RPAs. We should therefore cleanly return an error from the function responsible for updating the random address. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 217ef83..8604770 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3882,6 +3882,12 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, !bacmp(&hdev->random_addr, &hdev->rpa)) return 0; + if (!hdev->tfm_aes) { + BT_ERR("%s crypto not available to generate RPA", + hdev->name); + return -EOPNOTSUPP; + } + err = smp_generate_rpa(hdev->tfm_aes, hdev->irk, &hdev->rpa); if (err < 0) { BT_ERR("%s failed to generate new RPA", hdev->name);