All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Dionne <marc.dionne@auristor.com>
To: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
Cc: David Howells <dhowells@redhat.com>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-afs@lists.infradead.org, netdev <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 2/2] rxrpc: Fix rxrpc_local leak in rxrpc_lookup_peer()
Date: Tue, 23 Nov 2021 10:11:41 -0400	[thread overview]
Message-ID: <CAB9dFdsfEV9UFC-4vJ6QXdLV03FYK7N-QJAu84etqouOV8YMkw@mail.gmail.com> (raw)
In-Reply-To: <20211121041608.133740-2-eiichi.tsukata@nutanix.com>

On Sun, Nov 21, 2021 at 12:17 AM Eiichi Tsukata
<eiichi.tsukata@nutanix.com> wrote:
>
> Need to call rxrpc_put_local() for peer candidate before kfree() as it
> holds a ref to rxrpc_local.
>
> Fixes: 9ebeddef58c4 ("rxrpc: rxrpc_peer needs to hold a ref on the rxrpc_local record")
> Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
> ---
>  net/rxrpc/peer_object.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c
> index 68396d052052..431b62bc1da2 100644
> --- a/net/rxrpc/peer_object.c
> +++ b/net/rxrpc/peer_object.c
> @@ -364,10 +364,12 @@ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *rx,
>
>                 spin_unlock_bh(&rxnet->peer_hash_lock);
>
> -               if (peer)
> +               if (peer) {
> +                       rxrpc_put_local(candidate->local);
>                         kfree(candidate);
> -               else
> +               } else {
>                         peer = candidate;
> +               }
>         }
>
>         _net("PEER %d {%pISp}", peer->debug_id, &peer->srx.transport);
> --
> 2.33.1

Reviewed-by: Marc Dionne <marc.dionne@auristor.com>

Marc

  reply	other threads:[~2021-11-23 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21  4:16 [PATCH net 1/2] rxrpc: Fix rxrpc_peer leak in rxrpc_look_up_bundle() Eiichi Tsukata
2021-11-21  4:16 ` [PATCH net 2/2] rxrpc: Fix rxrpc_local leak in rxrpc_lookup_peer() Eiichi Tsukata
2021-11-23 14:11   ` Marc Dionne [this message]
2021-11-23 14:12 ` [PATCH net 1/2] rxrpc: Fix rxrpc_peer leak in rxrpc_look_up_bundle() Marc Dionne
2021-11-24 14:21 ` David Howells
2021-11-29 15:49 [PATCH net 0/2] rxrpc: Leak fixes David Howells
2021-11-29 15:49 ` [PATCH net 2/2] rxrpc: Fix rxrpc_local leak in rxrpc_lookup_peer() David Howells

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=CAB9dFdsfEV9UFC-4vJ6QXdLV03FYK7N-QJAu84etqouOV8YMkw@mail.gmail.com \
    --to=marc.dionne@auristor.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=eiichi.tsukata@nutanix.com \
    --cc=kuba@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.