From: Johan Hedberg Date: Wed, 11 Mar 2015 06:55:51 +0000 (+0200) Subject: Bluetooth: Fix missing rcu_read_unlock() in hci_bdaddr_is_paired() X-Git-Tag: v4.1-rc1~128^2~244^2~22 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=87c8b28d291de9999e9da2ef5d4165861983eb83;p=karo-tx-linux.git Bluetooth: Fix missing rcu_read_unlock() in hci_bdaddr_is_paired() When finding a matching LTK the rcu_read_unlock() function was failing to release the RCU read lock. This patch adds the missing call to rcu_reaD_unlock(). 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 a35d8441187a..4eba9d6fc9a5 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -2535,8 +2535,10 @@ bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) rcu_read_lock(); list_for_each_entry_rcu(k, &hdev->long_term_keys, list) { - if (k->bdaddr_type == addr_type && !bacmp(bdaddr, &k->bdaddr)) + if (k->bdaddr_type == addr_type && !bacmp(bdaddr, &k->bdaddr)) { + rcu_read_unlock(); return true; + } } rcu_read_unlock();