Skip to content

Commit 745542e

Browse files
jtlaytonSteve French
authored andcommitted
[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>
1 parent 7505e05 commit 745542e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎fs/cifs/cifsencrypt.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
9999
MD5Init(&context);
100100
MD5Update(&context, (char *)&key->data, key->len);
101101
for (i = 0; i < n_vec; i++) {
102+
if (iov[i].iov_len == 0)
103+
continue;
102104
if (iov[i].iov_base == NULL) {
103105
cERROR(1, ("null iovec entry"));
104106
return -EIO;
105-
} else if (iov[i].iov_len == 0)
106-
break; /* bail out if we are sent nothing to sign */
107+
}
107108
/* The first entry includes a length field (which does not get
108109
signed that occupies the first 4 bytes before the header */
109110
if (i == 0) {

0 commit comments

Comments
 (0)