Skip to content

Commit 1f0001d

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: zero out pointers after putting nfsd_files on COPY setup error
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 <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent ecfa398 commit 1f0001d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,8 +1214,10 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
12141214
return status;
12151215
out_put_dst:
12161216
nfsd_file_put(*dst);
1217+
*dst = NULL;
12171218
out_put_src:
12181219
nfsd_file_put(*src);
1220+
*src = NULL;
12191221
goto out;
12201222
}
12211223

0 commit comments

Comments
 (0)