From: Thiago Rafael Becker <thiago.becker@gmail.com>
To: bfields@fieldses.org, neilb@suse.com
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Thiago Rafael Becker <thiago.becker@gmail.com>
Subject: [PATCH 2/3, v3] kernel: Move groups_sort to the caller of set_groups.
Date: Mon, 4 Dec 2017 17:03:23 -0200 [thread overview]
Message-ID: <20171204190324.6629-3-thiago.becker@gmail.com> (raw)
In-Reply-To: <20171204190324.6629-1-thiago.becker@gmail.com>
The responsibility for calling groups_sort is now on the caller
of set_groups.
Signed-off-by: Thiago Rafael Becker <thiago.becker@gmail.com>
---
kernel/groups.c | 1 +
kernel/uid16.c | 1 +
net/sunrpc/svcauth_unix.c | 7 +++++++
3 files changed, 9 insertions(+)
diff --git a/kernel/groups.c b/kernel/groups.c
index 4c9c9ed..17073a9 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -208,6 +208,7 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
return retval;
}
+ groups_sort(group_info);
retval = set_current_groups(group_info);
put_group_info(group_info);
diff --git a/kernel/uid16.c b/kernel/uid16.c
index ce74a49..ef1da2a 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -192,6 +192,7 @@ SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist)
return retval;
}
+ groups_sort(group_info);
retval = set_current_groups(group_info);
put_group_info(group_info);
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 740b67d..94e2ac0 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -20,6 +20,7 @@
#include "netns.h"
+void groups_sort(struct group_info *group_info);
/*
* AUTHUNIX and AUTHNULL credentials are both handled here.
@@ -520,6 +521,12 @@ static int unix_gid_parse(struct cache_detail *cd,
ug.gi->gid[i] = kgid;
}
+ /* Sort the groups before inserting this entry
+ * into the cache to avoid future corrutpions
+ * by multiple simultaneous attempts to sort this
+ * entry.
+ */
+ groups_sort(ug.gi);
ugp = unix_gid_lookup(cd, uid);
if (ugp) {
struct cache_head *ch;
--
2.9.5
next prev parent reply other threads:[~2017-12-04 19:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 19:03 [PATCH 0/3, v3] Move groups_sort outisde of set_groups Thiago Rafael Becker
2017-12-04 19:03 ` [PATCH 1/3, v3] kernel: make groups_sort globally visible Thiago Rafael Becker
2017-12-04 19:03 ` Thiago Rafael Becker [this message]
2017-12-04 19:14 ` [PATCH 2/3, v3] kernel: Move groups_sort to the caller of set_groups Thiago Rafael Becker
2017-12-04 19:03 ` [PATCH 3/3, v3] kernel: set_groups doesn't call groups_sort anymore Thiago Rafael Becker
-- strict thread matches above, loose matches on Subject: below --
2017-11-30 13:04 [PATCH 0/3, V2] Move groups_sort outisde of set_groups Thiago Rafael Becker
2017-12-05 14:05 ` [PATCH 0/3 v3] " Thiago Rafael Becker
2017-12-05 14:05 ` [PATCH 2/3 v3] kernel: Move groups_sort to the caller " Thiago Rafael Becker
2017-12-05 18:57 ` Thiago Rafael Becker
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=20171204190324.6629-3-thiago.becker@gmail.com \
--to=thiago.becker@gmail.com \
--cc=bfields@fieldses.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.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).