All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "bcodding@redhat.com" <bcodding@redhat.com>
Cc: "xiyuyang19@fudan.edu.cn" <xiyuyang19@fudan.edu.cn>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] SUNRPC: Convert rpc_client refcount to use refcount_t
Date: Mon, 19 Jul 2021 12:07:00 +0000	[thread overview]
Message-ID: <190d0dec631a2219c4c16a41f7c17e914f625082.camel@hammerspace.com> (raw)
In-Reply-To: <6AF75462-495E-4B63-9A3E-C9639C45C1F2@redhat.com>

On Mon, 2021-07-19 at 08:01 -0400, Benjamin Coddington wrote:
> Hi Trond,
> 
> On 17 Jul 2021, at 13:20, trondmy@kernel.org wrote:
> 
> > @@ -943,7 +941,7 @@ rpc_release_client(struct rpc_clnt *clnt)
> >         do {
> >                 if (list_empty(&clnt->cl_tasks))
> >                         wake_up(&destroy_wait);
> > -               if (!atomic_dec_and_test(&clnt->cl_count))
> > +               if (refcount_dec_not_one(&clnt->cl_count))
> 
> I guess we're not worried about extra calls racing into
> rpc_free_auth?

The refcount would normally be going to zero in the above case. If
anything outside the RPC code itself tries to bump the counter then
that is a very clear cut case of use-after-free.

> 
> .. hmm, it looks like current code can do that already since we're
> bumping the
> ref up again.  Seems like we could end up in rpcauth_release twice
> with
> an underflow on au_count.
> 

As I said, only if there is a use-after-free bug somewhere else.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  reply	other threads:[~2021-07-19 12:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17 17:20 [PATCH] SUNRPC: Convert rpc_client refcount to use refcount_t trondmy
2021-07-19 12:01 ` Benjamin Coddington
2021-07-19 12:07   ` Trond Myklebust [this message]
2021-07-19 12:27     ` Benjamin Coddington
2021-07-26 12:01 trondmy

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=190d0dec631a2219c4c16a41f7c17e914f625082.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=bcodding@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=xiyuyang19@fudan.edu.cn \
    /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.