Commit a9156c09 authored by Trond Myklebust's avatar Trond Myklebust

RPCSEC_GSS: Fix integrity checksum bugs. Need to take into account the

starting offset when calculating the page length.
parent c20a2f14
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/pagemap.h>
#include <linux/sunrpc/gss_krb5.h> #include <linux/sunrpc/gss_krb5.h>
#ifdef RPC_DEBUG #ifdef RPC_DEBUG
...@@ -171,22 +172,24 @@ krb5_make_checksum(s32 cksumtype, char *header, struct xdr_buf *body, ...@@ -171,22 +172,24 @@ krb5_make_checksum(s32 cksumtype, char *header, struct xdr_buf *body,
} }
len = body->page_len; len = body->page_len;
offset = body->page_base; if (len != 0) {
i = 0; offset = body->page_base & (PAGE_CACHE_SIZE - 1);
while (len) { i = body->page_base >> PAGE_CACHE_SHIFT;
sg->page = body->pages[i]; thislen = PAGE_CACHE_SIZE - offset;
sg->offset = offset; do {
offset = 0; if (thislen > len)
if (PAGE_SIZE > len) thislen = len;
thislen = len; sg->page = body->pages[i];
else sg->offset = offset;
thislen = PAGE_SIZE; sg->length = thislen;
sg->length = thislen; kmap(sg->page); /* XXX kmap_atomic? */
kmap(sg->page); /* XXX kmap_atomic? */ crypto_digest_update(tfm, sg, 1);
crypto_digest_update(tfm, sg, 1); kunmap(sg->page);
kunmap(sg->page); len -= thislen;
len -= thislen; i++;
i++; offset = 0;
thislen = PAGE_CACHE_SIZE;
} while(len != 0);
} }
if (body->tail[0].iov_len) { if (body->tail[0].iov_len) {
buf_to_sg(sg, body->tail[0].iov_base, body->tail[0].iov_len); buf_to_sg(sg, body->tail[0].iov_base, body->tail[0].iov_len);
......
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