aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-09-13 11:08:45 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 14:11:49 -0500
commit8b7330f9057949e8c5df82df8a76068d0129e778 (patch)
tree2d98e4197fa082e2291439c9f089e6e6d596a3a7 /fs/nfsd
parent1311157d8407d16b8543c2286f0e95251ca04fe8 (diff)
nfsd: return better errors to exportfs
commit 427d6c6646d868fbd3094e7e2e1644d480cd9204 upstream. Someone noticed exportfs happily accepted exports that would later be rejected when mountd tried to give them to the kernel. Fix this. This is a regression from 4c1e1b34d5c800ad3ac9a7e2805b0bea70ad2278 "nfsd: Store ex_anon_uid and ex_anon_gid as kuids and kgids". Cc: "Eric W. Biederman" <ebiederm@xmission.com> Reported-by: Yin.JianHong <jiyin@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/export.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 5f38ea36e266..af51cf9bf2e3 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -536,16 +536,12 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
536 if (err) 536 if (err)
537 goto out3; 537 goto out3;
538 exp.ex_anon_uid= make_kuid(&init_user_ns, an_int); 538 exp.ex_anon_uid= make_kuid(&init_user_ns, an_int);
539 if (!uid_valid(exp.ex_anon_uid))
540 goto out3;
541 539
542 /* anon gid */ 540 /* anon gid */
543 err = get_int(&mesg, &an_int); 541 err = get_int(&mesg, &an_int);
544 if (err) 542 if (err)
545 goto out3; 543 goto out3;
546 exp.ex_anon_gid= make_kgid(&init_user_ns, an_int); 544 exp.ex_anon_gid= make_kgid(&init_user_ns, an_int);
547 if (!gid_valid(exp.ex_anon_gid))
548 goto out3;
549 545
550 /* fsid */ 546 /* fsid */
551 err = get_int(&mesg, &an_int); 547 err = get_int(&mesg, &an_int);
@@ -583,6 +579,17 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
583 exp.ex_uuid); 579 exp.ex_uuid);
584 if (err) 580 if (err)
585 goto out4; 581 goto out4;
582 /*
583 * For some reason exportfs has been passing down an
584 * invalid (-1) uid & gid on the "dummy" export which it
585 * uses to test export support. To make sure exportfs
586 * sees errors from check_export we therefore need to
587 * delay these checks till after check_export:
588 */
589 if (!uid_valid(exp.ex_anon_uid))
590 goto out4;
591 if (!gid_valid(exp.ex_anon_gid))
592 goto out4;
586 } 593 }
587 594
588 expp = svc_export_lookup(&exp); 595 expp = svc_export_lookup(&exp);