]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfsd: fix refcount leak when file is unhashed after being found
authorJeff Layton <jlayton@kernel.org>
Wed, 10 Jul 2024 13:05:32 +0000 (09:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:09 +0000 (16:33 +0200)
[ Upstream commit 8a7926176378460e0d91e02b03f0ff20a8709a60 ]

If we wait_for_construction and find that the file is no longer hashed,
and we're going to retry the open, the old nfsd_file reference is
currently leaked. Put the reference before retrying.

Fixes: c6593366c0bf ("nfsd: don't kill nfsd_files because of lease break error")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Youzhong Yang <youzhong@gmail.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/filecache.c

index f09d96ff20652ea674b2db55ee4829a4011edb97..e2e248032bfd04638089b51c7fd570ac080ac931 100644 (file)
@@ -1049,6 +1049,7 @@ wait_for_construction:
                        status = nfserr_jukebox;
                        goto construction_err;
                }
+               nfsd_file_put(nf);
                open_retry = false;
                fh_put(fhp);
                goto retry;