netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: missing lock releases in ipmr_base.c
@ 2022-01-21  3:22 ycaibb
  2022-01-21  7:58 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ycaibb @ 2022-01-21  3:22 UTC (permalink / raw)
  To: davem, yoshfuji, dsahern, kuba; +Cc: netdev, linux-kernel, ycaibb

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


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

end of thread, other threads:[~2022-01-27  8:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21  3:22 [PATCH] net: missing lock releases in ipmr_base.c ycaibb
2022-01-21  7:58 ` kernel test robot
2022-01-21  8:08 ` kernel test robot
2022-01-21 16:13 ` Stephen Hemminger
2022-01-27  8:35 ` [net] 33b03feaca: BUG:KASAN:slab-out-of-bounds_in_ip6_string kernel test robot

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).