[linux-cifs-client] [PATCH] [CIFS] have cifs_calc_signature2 skip zero length iovecs instead of bailing out

Jeff Layton jlayton at redhat.com
Thu Oct 25 11:27:18 GMT 2007


The SPNEGO patches I'm working on add a new iovec to CIFS_SessSetup
for the SecurityBlob. On non-SPNEGO mounts, this iovec is 0 length, and
that makes cifs_calc_signature2 bail out. Make it silently continue
instead (similar to how memcpy_{to|from}iovec behave).

Signed-off-by: Jeff Layton <jlayton at redhat.com>
---
 fs/cifs/cifsencrypt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 632070b..788f0ad 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -99,11 +99,12 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
 	MD5Init(&context);
 	MD5Update(&context, (char *)&key->data, key->len);
 	for (i = 0; i < n_vec; i++) {
+		if (iov[i].iov_len == 0)
+			continue;
 		if (iov[i].iov_base == NULL) {
 			cERROR(1, ("null iovec entry"));
 			return -EIO;
-		} else if (iov[i].iov_len == 0)
-			break; /* bail out if we are sent nothing to sign */
+		}
 		/* The first entry includes a length field (which does not get
 		   signed that occupies the first 4 bytes before the header */
 		if (i == 0) {
-- 
1.5.2.1



More information about the linux-cifs-client mailing list