diff options
author | J. Bruce Fields <bfields@redhat.com> | 2013-08-23 17:26:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-01 09:17:48 -0700 |
commit | ab2b9429c40a4083d675e15d79dc34f363096235 (patch) | |
tree | 220d2bda6a36d0c9e8921e87494d62bf093fd380 /net/sunrpc | |
parent | fea655196e39b35ef0d6c5a6372edb53315031db (diff) |
rpc: let xdr layer allocate gssproxy receieve pages
commit d4a516560fc96a9d486a9939bcb567e3fdce8f49 upstream.
In theory the linux cred in a gssproxy reply can include up to
NGROUPS_MAX data, 256K of data. In the common case we expect it to be
shorter. So do as the nfsv3 ACL code does and let the xdr code allocate
the pages as they come in, instead of allocating a lot of pages that
won't typically be used.
Tested-by: Simo Sorce <simo@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_gss/gss_rpc_upcall.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index be95af3d1058..f1eb0d16666c 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c @@ -223,18 +223,14 @@ static void gssp_free_receive_pages(struct gssx_arg_accept_sec_context *arg) static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) { - int i; - arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE); arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL); - - for (i=0; i < arg->npages; i++) { - arg->pages[i] = alloc_page(GFP_KERNEL); - if (arg->pages[i] == NULL) { - gssp_free_receive_pages(arg); - return -ENOMEM; - } - } + /* + * XXX: actual pages are allocated by xdr layer in + * xdr_partial_copy_from_skb. + */ + if (!arg->pages) + return -ENOMEM; return 0; } |