Ben Hutchings 3f84339bd3 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>
Cc: Wolfgang Walter <linux@stwm.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-31 12:06:14 +01:00
..
2015-06-30 19:44:57 -07:00
2017-12-20 10:04:56 +01:00
2017-08-06 19:19:42 -07:00
2015-06-25 17:00:42 -07:00
2017-11-30 08:37:20 +00:00
2017-06-14 13:16:24 +02:00
2017-08-06 19:19:42 -07:00
2016-11-10 16:36:34 +01:00
2017-12-20 10:05:00 +01:00
2015-11-13 20:34:33 -05:00
2015-11-23 21:11:08 -05:00
2016-10-07 15:23:47 +02:00
2015-11-10 12:07:22 -08:00
2017-06-14 13:16:24 +02:00
2015-11-16 23:54:45 -08:00
2017-08-06 19:19:42 -07:00
2015-11-16 23:54:45 -08:00
2015-08-12 15:28:45 -05:00
2017-06-14 13:16:24 +02:00
2017-08-06 19:19:42 -07:00
2017-06-14 13:16:24 +02:00