aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/nfs
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2021-11-27 23:02:04 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2021-12-11 02:38:11 +0000
commit9cd92bc5abdefb1897c3f948f50e66a3c21dff8e (patch)
tree520e50d4f9ebbd1055f9fad0009813ebd48cb668 /sys/fs/nfs
parentf43d2e1199b9fd265b72281d2779e2554fa7cb6d (diff)
downloadsrc-9cd92bc5abdefb1897c3f948f50e66a3c21dff8e.tar.gz
src-9cd92bc5abdefb1897c3f948f50e66a3c21dff8e.zip
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. PR: 260071 (cherry picked from commit 1c15c8c0e935f3f7def7b03e9546f7d6790f465e)
Diffstat (limited to 'sys/fs/nfs')
-rw-r--r--sys/fs/nfs/nfs_commonkrpc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 12c2787b1eda..93d305f0547b 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -959,6 +959,18 @@ tryagain:
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",