From: ycaibb <ycaibb@gmail.com>
To: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ycaibb@gmail.com
Subject: [PATCH] net: missing lock releases in ipmr_base.c
Date: Fri, 21 Jan 2022 11:22:10 +0800 [thread overview]
Message-ID: <20220121032210.5829-1-ycaibb@gmail.com> (raw)
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
next reply other threads:[~2022-01-21 3:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 3:22 ycaibb [this message]
2022-01-21 7:58 ` [PATCH] net: missing lock releases in ipmr_base.c 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220121032210.5829-1-ycaibb@gmail.com \
--to=ycaibb@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).