public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber•org>
To: ycaibb <ycaibb@gmail•com>
Cc: davem@davemloft•net, yoshfuji@linux-ipv6•org, dsahern@kernel•org,
	kuba@kernel•org, netdev@vger•kernel.org,
	linux-kernel@vger•kernel.org
Subject: Re: [PATCH] net: missing lock releases in ipmr_base.c
Date: Fri, 21 Jan 2022 08:13:11 -0800	[thread overview]
Message-ID: <20220121081311.2518068f@hermes.local> (raw)
In-Reply-To: <20220121032210.5829-1-ycaibb@gmail.com>

On Fri, 21 Jan 2022 11:22:10 +0800
ycaibb <ycaibb@gmail•com> wrote:

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

Another buggy patch, perhaps you write python or research papers?

  parent reply	other threads:[~2022-01-21 16:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20220121081311.2518068f@hermes.local \
    --to=stephen@networkplumber$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=dsahern@kernel$(echo .)org \
    --cc=kuba@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=ycaibb@gmail$(echo .)com \
    --cc=yoshfuji@linux-ipv6$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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