public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/2] NFSD: Fix use-after-free warning when doing inter-server copy
Date: Thu, 29 Oct 2020 15:07:15 -0400	[thread overview]
Message-ID: <20201029190716.70481-2-dai.ngo@oracle.com> (raw)
In-Reply-To: <20201029190716.70481-1-dai.ngo@oracle.com>

The source file nfsd_file is not constructed the same as other
nfsd_file's via nfsd_file_alloc. nfsd_file_put should not be
called to free the object; nfsd_file_put is not the inverse of
kzalloc, instead kfree is called by nfsd4_do_async_copy when done.

Fixes: ce0887ac96d3 ("NFSD add nfs4 inter ssc to nfsd4_copy")
Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index ad2fa1a8e7ad..9c43cad7e408 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1299,7 +1299,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
 			struct nfsd_file *dst)
 {
 	nfs42_ssc_close(src->nf_file);
-	nfsd_file_put(src);
+	/* 'src' is freed by nfsd4_do_async_copy */
 	nfsd_file_put(dst);
 	mntput(ss_mnt);
 }
-- 
2.20.1.1226.g1595ea5.dirty


  reply	other threads:[~2020-10-29 19:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 19:07 [PATCH 0/2] NFSD: Fix use-after-free warning when doing inter-server copy Dai Ngo
2020-10-29 19:07 ` Dai Ngo [this message]
2021-02-20  0:18   ` [PATCH 1/2] " Olga Kornievskaia
2021-02-20  1:09     ` J. Bruce Fields
2021-02-20  1:15       ` dai.ngo
2021-02-20  1:31       ` dai.ngo
2021-02-20  3:20         ` J. Bruce Fields
2021-02-20  3:41           ` dai.ngo
2021-02-20 14:08           ` Olga Kornievskaia
2021-02-21  4:16             ` dai.ngo
2021-02-22 18:34               ` dai.ngo
2021-02-22 21:46                 ` dai.ngo
2021-02-22 22:01                   ` dai.ngo
2021-02-22 22:08                     ` dai.ngo
2021-02-24 22:35                       ` Olga Kornievskaia
2021-02-25  2:26                         ` dai.ngo
2021-02-25 18:58                           ` dai.ngo
2021-03-01 18:15                             ` Chuck Lever
2020-10-29 19:07 ` [PATCH 2/2] NFSD: fix missing refcount in nfsd4_copy by nfsd4_do_async_copy Dai Ngo
2020-11-05 22:25 ` [PATCH 0/2] NFSD: Fix use-after-free warning when doing inter-server copy J. Bruce Fields

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=20201029190716.70481-2-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox