linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: bluetooth: hci_core: Fix Suspicious RCU usage warnings
@ 2020-02-25 13:08 madhuparnabhowmik10
  2020-02-28  7:37 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: madhuparnabhowmik10 @ 2020-02-25 13:08 UTC (permalink / raw)
  To: marcel, johan.hedberg, davem, kuba
  Cc: linux-bluetooth, netdev, linux-kernel, joel,
	linux-kernel-mentees, frextrite, paulmck, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

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 <madhuparnabhowmik10@gmail.com>
---
 net/bluetooth/hci_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index cbbc34a006d1..8ddd1bea02be 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2285,7 +2285,7 @@ void hci_link_keys_clear(struct hci_dev *hdev)
 {
 	struct link_key *key;
 
-	list_for_each_entry_rcu(key, &hdev->link_keys, list) {
+	list_for_each_entry(key, &hdev->link_keys, list) {
 		list_del_rcu(&key->list);
 		kfree_rcu(key, rcu);
 	}
@@ -2295,7 +2295,7 @@ void hci_smp_ltks_clear(struct hci_dev *hdev)
 {
 	struct smp_ltk *k;
 
-	list_for_each_entry_rcu(k, &hdev->long_term_keys, list) {
+	list_for_each_entry(k, &hdev->long_term_keys, list) {
 		list_del_rcu(&k->list);
 		kfree_rcu(k, rcu);
 	}
@@ -2305,7 +2305,7 @@ void hci_smp_irks_clear(struct hci_dev *hdev)
 {
 	struct smp_irk *k;
 
-	list_for_each_entry_rcu(k, &hdev->identity_resolving_keys, list) {
+	list_for_each_entry(k, &hdev->identity_resolving_keys, list) {
 		list_del_rcu(&k->list);
 		kfree_rcu(k, rcu);
 	}
@@ -2315,7 +2315,7 @@ void hci_blocked_keys_clear(struct hci_dev *hdev)
 {
 	struct blocked_key *b;
 
-	list_for_each_entry_rcu(b, &hdev->blocked_keys, list) {
+	list_for_each_entry(b, &hdev->blocked_keys, list) {
 		list_del_rcu(&b->list);
 		kfree_rcu(b, rcu);
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: bluetooth: hci_core: Fix Suspicious RCU usage warnings
  2020-02-25 13:08 [PATCH] net: bluetooth: hci_core: Fix Suspicious RCU usage warnings madhuparnabhowmik10
@ 2020-02-28  7:37 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-02-28  7:37 UTC (permalink / raw)
  To: madhuparnabhowmik10
  Cc: Johan Hedberg, David S. Miller, kuba, linux-bluetooth, netdev,
	linux-kernel, joel, linux-kernel-mentees, frextrite, paulmck

Hi Madhuparna,

> 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 <madhuparnabhowmik10@gmail.com>
> ---
> net/bluetooth/hci_core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-28  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-25 13:08 [PATCH] net: bluetooth: hci_core: Fix Suspicious RCU usage warnings madhuparnabhowmik10
2020-02-28  7:37 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).