From: Jeff Layton <jlayton@poochiereds.net>
To: trond.myklebust@primarydata.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/8] sunrpc: allow generic_match to handle creds with NULL group_info ptr
Date: Thu, 14 Apr 2016 08:36:58 -0400 [thread overview]
Message-ID: <1460637425-1580-2-git-send-email-jeff.layton@primarydata.com> (raw)
In-Reply-To: <1460637425-1580-1-git-send-email-jeff.layton@primarydata.com>
This function seems to assume that the group_info is never NULL. If we
fix it not to assume that then we should be able to avoid allocating
group_info for flexfiles DS creds.
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
---
net/sunrpc/auth_generic.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c
index 41248b1820c7..0bb0d58f240b 100644
--- a/net/sunrpc/auth_generic.c
+++ b/net/sunrpc/auth_generic.c
@@ -151,7 +151,7 @@ static int
generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
{
struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base);
- int i;
+ int i, gnum;
if (acred->machine_cred)
return machine_cred_match(acred, gcred, flags);
@@ -166,9 +166,12 @@ generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
goto out_match;
/* Slow path... */
- if (gcred->acred.group_info->ngroups != acred->group_info->ngroups)
+ i = acred->group_info ? acred->group_info->ngroups : 0;
+ gnum = gcred->acred.group_info ? gcred->acred.group_info->ngroups : 0;
+
+ if (gnum != i)
goto out_nomatch;
- for (i = 0; i < gcred->acred.group_info->ngroups; i++) {
+ for (i = 0; i < gnum; i++) {
if (!gid_eq(GROUP_AT(gcred->acred.group_info, i),
GROUP_AT(acred->group_info, i)))
goto out_nomatch;
--
2.5.5
next prev parent reply other threads:[~2016-04-14 12:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 12:36 [PATCH 0/8] nfs/sunrpc: fix flexfiles credential handling Jeff Layton
2016-04-14 12:36 ` Jeff Layton [this message]
2016-04-14 12:36 ` [PATCH 2/8] sunrpc: plumb gfp_t parm into crcreate operation Jeff Layton
2016-04-14 12:37 ` [PATCH 3/8] sunrpc: add rpc_lookup_generic_cred Jeff Layton
2016-04-14 12:37 ` [PATCH 4/8] sunrpc: add a get_rpccred_rcu inline Jeff Layton
2016-04-14 12:37 ` [PATCH 5/8] nfs: don't call nfs4_ff_layout_prepare_ds from ff_layout_get_ds_cred Jeff Layton
2016-04-14 12:37 ` [PATCH 6/8] nfs: have ff_layout_get_ds_cred take a reference to the cred Jeff Layton
2016-04-14 14:29 ` Jeff Layton
2016-04-14 12:37 ` [PATCH 7/8] nfs: get a reference to the credential in ff_layout_alloc_lseg Jeff Layton
2016-04-14 12:37 ` [PATCH 8/8] nfs: have flexfiles mirror keep creds for both ro and rw layouts Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460637425-1580-2-git-send-email-jeff.layton@primarydata.com \
--to=jlayton@poochiereds.net \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).