From: Chuck Lever Date: Sun, 26 Jan 2025 21:50:17 +0000 (-0500) Subject: NFSD: nfsd_unlink() clobbers non-zero status returned from fh_fill_pre_attrs() X-Git-Tag: v6.12.23~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=101fd0aa0d7d502ea947cdc20abdc9a6e565dea0;p=thirdparty%2Fkernel%2Fstable.git NFSD: nfsd_unlink() clobbers non-zero status returned from fh_fill_pre_attrs() commit d7d8e3169b56e7696559a2427c922c0d55debcec upstream. If fh_fill_pre_attrs() returns a non-zero status, the error flow takes it through out_unlock, which then overwrites the returned status code with err = nfserrno(host_err); Fixes: a332018a91c4 ("nfsd: handle failure to collect pre/post-op attrs more sanely") Reviewed-by: Jeff Layton Cc: stable@vger.kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index d6d4f2a0e8982..82530d5056269 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -2015,11 +2015,9 @@ out_nfserr: * error status. */ err = nfserr_file_open; - } else { - err = nfserrno(host_err); } out: - return err; + return err != nfs_ok ? err : nfserrno(host_err); out_unlock: inode_unlock(dirp); goto out_drop_write;