Skip to contentSkip to conversation

llc: avoid blocking in llc_sap_close()

PATCH Applied Cong Wang 2 participants 2 messages Sep 11, 2018 – Sep 13, 2018

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 llc: avoid blocking in llc_sap_close()

llc_sap_close() is called by llc_sap_put() which could be called in BH context in llc_rcv(). We can't block in BH.

There is no reason to block it here, kfree_rcu() should be sufficient.

---
 include/net/llc.h  | 1 +
 net/llc/llc_core.c | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
include/net/llc.h +1 -0
index 890a87318014..df282d9b4017 100644
@@ -66,6 +66,7 @@ struct llc_sap {
 	int sk_count;
 	struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES];
 	struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES];
+	struct rcu_head rcu;
 };
 
 static inline
net/llc/llc_core.c +1 -3
index 260b3dc1b4a2..64d4bef04e73 100644
@@ -127,9 +127,7 @@ void llc_sap_close(struct llc_sap *sap)
 	list_del_rcu(&sap->node);
 	spin_unlock_bh(&llc_sap_list_lock);
 
-	synchronize_rcu();
-
-	kfree(sap);
+	kfree_rcu(sap, rcu);
 }
 
 static struct packet_type llc_packet_type __read_mostly = {
Signature · 1 line
2.14.4
maintainer Applied
#1 lore raw

From: Cong Wang <[email protected]>
Date: Tue, 11 Sep 2018 11:42:06 -0700

Quoted 8 lines

llc_sap_close() is called by llc_sap_put() which could be called in BH context in llc_rcv(). We can't block in BH.

There is no reason to block it here, kfree_rcu() should be sufficient.

Applied, thanks Cong.