Skip to content

Commit d7d4168

Browse files
Madhuparna Bhowmikholtmann
authored andcommitted
Bluetooth: Fix Suspicious RCU usage warnings
The following functions in hci_core are always called with hdev->lock held. No need to use list_for_each_entry_rcu(), therefore change the usage of list_for_each_entry_rcu() in these functions to list_for_each_entry(). hci_link_keys_clear() hci_smp_ltks_clear() hci_smp_irks_clear() hci_blocked_keys_clear() Warning encountered with CONFIG_PROVE_RCU_LIST: [ 72.213184] ============================= [ 72.213188] WARNING: suspicious RCU usage [ 72.213192] 5.6.0-rc1+ #5 Not tainted [ 72.213195] ----------------------------- [ 72.213198] net/bluetooth/hci_core.c:2288 RCU-list traversed in non-reader section!! [ 72.213676] ============================= [ 72.213679] WARNING: suspicious RCU usage [ 72.213683] 5.6.0-rc1+ #5 Not tainted [ 72.213685] ----------------------------- [ 72.213689] net/bluetooth/hci_core.c:2298 RCU-list traversed in non-reader section!! [ 72.214195] ============================= [ 72.214198] WARNING: suspicious RCU usage [ 72.214201] 5.6.0-rc1+ #5 Not tainted [ 72.214204] ----------------------------- [ 72.214208] net/bluetooth/hci_core.c:2308 RCU-list traversed in non-reader section!! [ 333.456972] ============================= [ 333.456979] WARNING: suspicious RCU usage [ 333.457001] 5.6.0-rc1+ #5 Not tainted [ 333.457007] ----------------------------- [ 333.457014] net/bluetooth/hci_core.c:2318 RCU-list traversed in non-reader section!! Signed-off-by: Madhuparna Bhowmik <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent a7e4545 commit d7d4168

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/bluetooth/hci_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ void hci_link_keys_clear(struct hci_dev *hdev)
22852285
{
22862286
struct link_key *key;
22872287

2288-
list_for_each_entry_rcu(key, &hdev->link_keys, list) {
2288+
list_for_each_entry(key, &hdev->link_keys, list) {
22892289
list_del_rcu(&key->list);
22902290
kfree_rcu(key, rcu);
22912291
}
@@ -2295,7 +2295,7 @@ void hci_smp_ltks_clear(struct hci_dev *hdev)
22952295
{
22962296
struct smp_ltk *k;
22972297

2298-
list_for_each_entry_rcu(k, &hdev->long_term_keys, list) {
2298+
list_for_each_entry(k, &hdev->long_term_keys, list) {
22992299
list_del_rcu(&k->list);
23002300
kfree_rcu(k, rcu);
23012301
}
@@ -2305,7 +2305,7 @@ void hci_smp_irks_clear(struct hci_dev *hdev)
23052305
{
23062306
struct smp_irk *k;
23072307

2308-
list_for_each_entry_rcu(k, &hdev->identity_resolving_keys, list) {
2308+
list_for_each_entry(k, &hdev->identity_resolving_keys, list) {
23092309
list_del_rcu(&k->list);
23102310
kfree_rcu(k, rcu);
23112311
}
@@ -2315,7 +2315,7 @@ void hci_blocked_keys_clear(struct hci_dev *hdev)
23152315
{
23162316
struct blocked_key *b;
23172317

2318-
list_for_each_entry_rcu(b, &hdev->blocked_keys, list) {
2318+
list_for_each_entry(b, &hdev->blocked_keys, list) {
23192319
list_del_rcu(&b->list);
23202320
kfree_rcu(b, rcu);
23212321
}

0 commit comments

Comments
 (0)