diff options
author | J. Bruce Fields <bfields@redhat.com> | 2013-09-13 11:08:45 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-10-29 17:45:30 -0400 |
commit | 427d6c6646d868fbd3094e7e2e1644d480cd9204 (patch) | |
tree | 78a6becf2230156f9e75dab083747b3a605f6741 /fs/nfsd | |
parent | 49e7372063a220651b4f12fa46113559533cafee (diff) |
nfsd: return better errors to exportfs
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>
Cc: stable@vger.kernel.org
Reported-by: Yin.JianHong <jiyin@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/export.c | 15 |
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); |