Commit 745542e2 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

[CIFS] allow cifs_calc_signature2 to deal with a zero length iovec

Currently, cifs_calc_signature2 errors out if it gets a zero-length
iovec. Fix it to silently continue in that case.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 7505e052
...@@ -99,11 +99,12 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, ...@@ -99,11 +99,12 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
MD5Init(&context); MD5Init(&context);
MD5Update(&context, (char *)&key->data, key->len); MD5Update(&context, (char *)&key->data, key->len);
for (i = 0; i < n_vec; i++) { for (i = 0; i < n_vec; i++) {
if (iov[i].iov_len == 0)
continue;
if (iov[i].iov_base == NULL) { if (iov[i].iov_base == NULL) {
cERROR(1, ("null iovec entry")); cERROR(1, ("null iovec entry"));
return -EIO; 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 /* The first entry includes a length field (which does not get
signed that occupies the first 4 bytes before the header */ signed that occupies the first 4 bytes before the header */
if (i == 0) { if (i == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment