]> 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>
Thu, 17 Oct 2024 13:07:53 +0000 (15:07 +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 96a2be833b20b6e7f97b1112f6cd9d906392b561..31169f0cc3d74839a3a885b1e0c4a0d41a62112e 100644 (file)
@@ -1054,6 +1054,7 @@ wait_for_construction:
                        status = nfserr_jukebox;
                        goto construction_err;
                }
+               nfsd_file_put(nf);
                open_retry = false;
                goto retry;
        }