Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3132aa35 authored by Jeff Layton's avatar Jeff Layton Committed by Greg Kroah-Hartman
Browse files

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: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 38b4d3ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1059,8 +1059,10 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
	return status;
out_put_dst:
	nfsd_file_put(*dst);
	*dst = NULL;
out_put_src:
	nfsd_file_put(*src);
	*src = NULL;
	goto out;
}