From: Jeff Layton Date: Tue, 17 Jan 2023 19:38:30 +0000 (-0500) Subject: nfsd: zero out pointers after putting nfsd_files on COPY setup error X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bde7dcd77807b8db0952e92ab8bb9b67a42d4ada;p=linux.git nfsd: zero out pointers after putting nfsd_files on COPY setup error [ Upstream commit 1f0001d43d0c0ac2a19a34a914f6595ad97cbc1d ] At first, I thought this might be a source of nfsd_file overputs, but the current callers seem to avoid an extra put when nfsd4_verify_copy returns an error. Still, it's "bad form" to leave the pointers filled out when we don't have a reference to them anymore, and that might lead to bugs later. Zero them out as a defensive coding measure. Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 0a900b9e39eac..57af9c30eb48d 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1088,8 +1088,10 @@ out: return status; out_put_dst: nfsd_file_put(*dst); + *dst = NULL; out_put_src: nfsd_file_put(*src); + *src = NULL; goto out; }