diff options
-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); |