Commit 21348425 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Trond Myklebust

[PATCH] fix nfsacl pointer arithmetic and pg_class initialization bugs

* Pointer arithmetic bug: p is in word units. This fixes a memory
  corruption with big acls.
* Initialize pg_class to prevent a NULL pointer access.
Signed-off-by: default avatarAndreas Gruenbacher <agruen@suse.de>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 458818ed
...@@ -677,7 +677,7 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p, ...@@ -677,7 +677,7 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, u32 *p,
/* put as much of the acls into head as possible. */ /* put as much of the acls into head as possible. */
len_in_head = min_t(unsigned int, buf->head->iov_len - base, len); len_in_head = min_t(unsigned int, buf->head->iov_len - base, len);
len -= len_in_head; len -= len_in_head;
req->rq_slen = xdr_adjust_iovec(req->rq_svec, p + len_in_head); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p + (len_in_head >> 2));
for (count = 0; (count << PAGE_SHIFT) < len; count++) { for (count = 0; (count << PAGE_SHIFT) < len; count++) {
args->pages[count] = alloc_page(GFP_KERNEL); args->pages[count] = alloc_page(GFP_KERNEL);
......
...@@ -376,6 +376,7 @@ static struct svc_program nfsd_acl_program = { ...@@ -376,6 +376,7 @@ static struct svc_program nfsd_acl_program = {
.pg_nvers = NFSD_ACL_NRVERS, .pg_nvers = NFSD_ACL_NRVERS,
.pg_vers = nfsd_acl_version, .pg_vers = nfsd_acl_version,
.pg_name = "nfsd", .pg_name = "nfsd",
.pg_class = "nfsd",
.pg_stats = &nfsd_acl_svcstats, .pg_stats = &nfsd_acl_svcstats,
}; };
......
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