mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
nfsd: fix crash on COPY_NOTIFY with special stateid
[ Upstream commit074b07d94e] RTM says "If the special ONE stateid is passed to nfs4_preprocess_stateid_op(), it returns status=0 but does not set *cstid. nfsd4_copy_notify() depends on stid being set if status=0, and thus can crash if the client sends the right COPY_NOTIFY RPC." RFC 7862 says "The cna_src_stateid MUST refer to either open or locking states provided earlier by the server. If it is invalid, then the operation MUST fail." The RFC doesn't specify an error, and the choice doesn't matter much as this is clearly illegal client behavior, but bad_stateid seems reasonable. Simplest is just to guarantee that nfs4_preprocess_stateid_op, called with non-NULL cstid, errors out if it can't return a stateid. Reported-by: rtm@csail.mit.edu Fixes:624322f1ad("NFSD add COPY_NOTIFY operation") Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Olga Kornievskaia <kolga@netapp.com> Tested-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0f84cfb465
commit
4425ca3677
@@ -6042,7 +6042,11 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp,
|
||||
*nfp = NULL;
|
||||
|
||||
if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) {
|
||||
status = check_special_stateids(net, fhp, stateid, flags);
|
||||
if (cstid)
|
||||
status = nfserr_bad_stateid;
|
||||
else
|
||||
status = check_special_stateids(net, fhp, stateid,
|
||||
flags);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user