lkml.org 
[lkml]   [2022]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] net: missing lock releases in ipmr_base.c
Date
From: Ryan Cai <ycaibb@gmail.com>

In method mr_mfc_seq_idx, the lock it->lock and rcu_read_lock are not released when pos-- == 0 is true.

Signed-off-by: Ryan Cai <ycaibb@gmail.com>
---
net/ipv4/ipmr_base.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c
index aa8738a91210..c4a247024c85 100644
--- a/net/ipv4/ipmr_base.c
+++ b/net/ipv4/ipmr_base.c
@@ -154,6 +154,7 @@ void *mr_mfc_seq_idx(struct net *net,
it->cache = &mrt->mfc_cache_list;
list_for_each_entry_rcu(mfc, &mrt->mfc_cache_list, list)
if (pos-- == 0)
+ rcu_read_unlock();
return mfc;
rcu_read_unlock();

@@ -161,6 +162,7 @@ void *mr_mfc_seq_idx(struct net *net,
it->cache = &mrt->mfc_unres_queue;
list_for_each_entry(mfc, it->cache, list)
if (pos-- == 0)
+ spin_unlock_bh(it->lock);
return mfc;
spin_unlock_bh(it->lock);

--
2.33.0
\
 
 \ /
  Last update: 2022-01-21 04:24    [W:0.074 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site