changeset 23852:638ed2c18636

13330 SMB read hangs on Mac Big Sur Reviewed by: Robert Mustacchi <rm@fingolfin.org> Reviewed by: Paul Winder <pwinder@racktopsystems.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Matt Barden <mbarden@tintri.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Gordon Ross <gordon.ross@tintri.com>
date Mon, 23 Nov 2020 19:51:44 -0500
parents c5f32a3d1264
children a82920adb0ad
files usr/src/uts/common/fs/smbsrv/smb2_read.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/smbsrv/smb2_read.c	Wed Nov 25 18:51:29 2020 +0000
+++ b/usr/src/uts/common/fs/smbsrv/smb2_read.c	Mon Nov 23 19:51:44 2020 -0500
@@ -10,11 +10,12 @@
  */
 
 /*
- * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2020 Tintri by DDN, Inc. All rights reserved.
  */
 
 /*
  * Dispatch function for SMB2_READ
+ * MS-SMB2 sec. 3.3.5.12
  */
 
 #include <smbsrv/smb2_kproto.h>
@@ -160,6 +161,14 @@
 	MBC_ATTACH_MBUF(&sr->raw_data, m);
 
 	/*
+	 * [MS-SMB2] If the read returns fewer bytes than specified by
+	 * the MinimumCount field of the request, the server MUST fail
+	 * the request with STATUS_END_OF_FILE
+	 */
+	if (status == 0 && XferCount < MinCount)
+		status = NT_STATUS_END_OF_FILE;
+
+	/*
 	 * Checking the error return _after_ dealing with
 	 * the returned data so that if m was allocated,
 	 * it will be free'd via sr->raw_data cleanup.