diff mbox series

mac80211: mesh: fix missing unlock on error in table_path_del()

Message ID 20190218065216.155259-1-weiyongjun1@huawei.com (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show
Series mac80211: mesh: fix missing unlock on error in table_path_del() | expand

Commit Message

Wei Yongjun Feb. 18, 2019, 6:52 a.m. UTC
spin_lock_bh() is used in table_path_del() but rcu_read_unlock()
is used for unlocking. Fix it by using spin_unlock_bh() instead
of rcu_read_unlock() in the error handling case.

Fixes: b4c3fbe63601 ("mac80211: Use linked list instead of rhashtable walk for mesh tables")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/mac80211/mesh_pathtbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu Feb. 18, 2019, 10:25 a.m. UTC | #1
On Mon, Feb 18, 2019 at 06:52:16AM +0000, Wei Yongjun wrote:
> spin_lock_bh() is used in table_path_del() but rcu_read_unlock()
> is used for unlocking. Fix it by using spin_unlock_bh() instead
> of rcu_read_unlock() in the error handling case.
> 
> Fixes: b4c3fbe63601 ("mac80211: Use linked list instead of rhashtable walk for mesh tables")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks for catching this!
diff mbox series

Patch

diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index c3a7396fb955..9bdeac2749e9 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -627,7 +627,7 @@  static int table_path_del(struct mesh_table *tbl,
 	spin_lock_bh(&tbl->walk_lock);
 	mpath = rhashtable_lookup_fast(&tbl->rhead, addr, mesh_rht_params);
 	if (!mpath) {
-		rcu_read_unlock();
+		spin_unlock_bh(&tbl->walk_lock);
 		return -ENXIO;
 	}