summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2018-07-25 15:00:17 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2018-07-25 15:00:17 -0400
commita6181681a7da7785b3c7746eb8b6c8a1b72c24e4 (patch)
tree9f5307b2951ea3c7f9bcafa6c620db5d519afe17
parentea8c17a4d5ef33cce5d57ca7c3b9a4c7a5ca61be (diff)
downloadlongterm-queue-4.12-a6181681a7da7785b3c7746eb8b6c8a1b72c24e4.tar.gz
nfsd: add fix for fixes
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/nfsd-auth-Fix-gid-sorting-when-rootsquash-enabled.patch44
-rw-r--r--queue/series1
2 files changed, 45 insertions, 0 deletions
diff --git a/queue/nfsd-auth-Fix-gid-sorting-when-rootsquash-enabled.patch b/queue/nfsd-auth-Fix-gid-sorting-when-rootsquash-enabled.patch
new file mode 100644
index 0000000..8df703f
--- /dev/null
+++ b/queue/nfsd-auth-Fix-gid-sorting-when-rootsquash-enabled.patch
@@ -0,0 +1,44 @@
+From 1995266727fa8143897e89b55f5d3c79aa828420 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Date: Mon, 22 Jan 2018 20:11:06 +0000
+Subject: [PATCH] nfsd: auth: Fix gid sorting when rootsquash enabled
+
+commit 1995266727fa8143897e89b55f5d3c79aa828420 upstream.
+
+Commit bdcf0a423ea1 ("kernel: make groups_sort calling a responsibility
+group_info allocators") appears to break nfsd rootsquash in a pretty
+major way.
+
+It adds a call to groups_sort() inside the loop that copies/squashes
+gids, which means the valid gids are sorted along with the following
+garbage. The net result is that the highest numbered valid gids are
+replaced with any lower-valued garbage gids, possibly including 0.
+
+We should sort only once, after filling in all the gids.
+
+Fixes: bdcf0a423ea1 ("kernel: make groups_sort calling a responsibility ...")
+Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Acked-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+
+diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
+index f650e475d8f0..fdf2aad73470 100644
+--- a/fs/nfsd/auth.c
++++ b/fs/nfsd/auth.c
+@@ -60,10 +60,10 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
+ gi->gid[i] = exp->ex_anon_gid;
+ else
+ gi->gid[i] = rqgi->gid[i];
+-
+- /* Each thread allocates its own gi, no race */
+- groups_sort(gi);
+ }
++
++ /* Each thread allocates its own gi, no race */
++ groups_sort(gi);
+ } else {
+ gi = get_group_info(rqgi);
+ }
+--
+2.15.0
+
diff --git a/queue/series b/queue/series
index 44bd6ea..7395a62 100644
--- a/queue/series
+++ b/queue/series
@@ -15,6 +15,7 @@ xhci-Don-t-add-a-virt_dev-to-the-devs-array-before-i.patch
nfs-don-t-wait-on-commit-in-nfs_commit_inode-if-ther.patch
NFS-Use-an-atomic_long_t-to-count-the-number-of-comm.patch
NFS-Fix-unstable-write-completion.patch
+nfsd-auth-Fix-gid-sorting-when-rootsquash-enabled.patch
scsi-core-Fix-a-scsi_show_rq-NULL-pointer-dereferenc.patch
dm-fix-various-targets-to-dm_register_target-after-m.patch
iw_cxgb4-only-insert-drain-cqes-if-wq-is-flushed.patch