From: Jeff Layton Date: Wed, 10 Jul 2024 13:05:32 +0000 (-0400) Subject: nfsd: fix refcount leak when file is unhashed after being found X-Git-Tag: v6.12-rc1~97^2~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8a7926176378460e0d91e02b03f0ff20a8709a60;p=thirdparty%2Fkernel%2Flinux.git nfsd: fix refcount leak when file is unhashed after being found 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 Tested-by: Youzhong Yang Signed-off-by: Chuck Lever --- diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 9d7bb65b07463..6af4e6027227f 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -1051,6 +1051,7 @@ wait_for_construction: status = nfserr_jukebox; goto construction_err; } + nfsd_file_put(nf); open_retry = false; fh_put(fhp); goto retry;