diff options
author | Jeff Layton <jlayton@redhat.com> | 2007-11-03 00:34:04 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-11-03 00:34:04 -0400 |
commit | 745542e210b3b15751ea9d511321924ac36b85db (patch) | |
tree | d1d696a239239e61f2edc2ca903dc88c32d2065d | |
parent | 7505e0525c914cdfdb54f43a7e70f038a16a5486 (diff) |
[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: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | 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 632070b4275d..788f0ad6feda 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, | |||
99 | MD5Init(&context); | 99 | MD5Init(&context); |
100 | MD5Update(&context, (char *)&key->data, key->len); | 100 | MD5Update(&context, (char *)&key->data, key->len); |
101 | for (i = 0; i < n_vec; i++) { | 101 | for (i = 0; i < n_vec; i++) { |
102 | if (iov[i].iov_len == 0) | ||
103 | continue; | ||
102 | if (iov[i].iov_base == NULL) { | 104 | if (iov[i].iov_base == NULL) { |
103 | cERROR(1, ("null iovec entry")); | 105 | cERROR(1, ("null iovec entry")); |
104 | return -EIO; | 106 | return -EIO; |
105 | } else if (iov[i].iov_len == 0) | 107 | } |
106 | break; /* bail out if we are sent nothing to sign */ | ||
107 | /* The first entry includes a length field (which does not get | 108 | /* The first entry includes a length field (which does not get |
108 | signed that occupies the first 4 bytes before the header */ | 109 | signed that occupies the first 4 bytes before the header */ |
109 | if (i == 0) { | 110 | if (i == 0) { |