nfscl: Sanity check the Sequence slotid in reply

The slotid in the Sequence reply must be the same as
in the request.  Check that it is the same and log
a console message if it is not, plus set it to the
correct value.

Reported by:	rtm@lcs.mit.edu
Tested by:	rtm@lcs.mit.edu
PR:	260071
MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2021-11-27 15:02:04 -08:00
parent 228e020a3b
commit 1c15c8c0e9

View file

@ -1038,6 +1038,18 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
retseq = fxdr_unsigned(uint32_t, *tl++);
slot = fxdr_unsigned(int, *tl++);
if ((nd->nd_flag & ND_HASSLOTID) != 0) {
if (slot != nd->nd_slotid) {
printf("newnfs_request:"
" Wrong session "
"slot=%d\n", slot);
slot = nd->nd_slotid;
}
} else if (slot != 0) {
printf("newnfs_request: Bad "
"session slot=%d\n", slot);
slot = 0;
}
freeslot = slot;
if (retseq != sep->nfsess_slotseq[slot])
printf("retseq diff 0x%x\n",