aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-08-23 17:26:28 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-09-06 11:45:58 -0400
commitd4a516560fc96a9d486a9939bcb567e3fdce8f49 (patch)
treeb7cf4d198b901d81b8403667f1bda1f2329b48c7 /net/sunrpc/auth_gss
parent9dfd87da1aeb0fd364167ad199f40fe96a6a87be (diff)
rpc: let xdr layer allocate gssproxy receieve pages
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>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_upcall.c16
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)
223 223
224static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) 224static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)
225{ 225{
226 int i;
227
228 arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE); 226 arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE);
229 arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL); 227 arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL);
230 228 /*
231 for (i=0; i < arg->npages; i++) { 229 * XXX: actual pages are allocated by xdr layer in
232 arg->pages[i] = alloc_page(GFP_KERNEL); 230 * xdr_partial_copy_from_skb.
233 if (arg->pages[i] == NULL) { 231 */
234 gssp_free_receive_pages(arg); 232 if (!arg->pages)
235 return -ENOMEM; 233 return -ENOMEM;
236 }
237 }
238 return 0; 234 return 0;
239} 235}
240 236