aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 5f38ea36e266..8513c598fabf 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,26 @@ 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 * No point caching this if it would immediately expire.
584 * Also, this protects exportfs's dummy export from the
585 * anon_uid/anon_gid checks:
586 */
587 if (exp.h.expiry_time < seconds_since_boot())
588 goto out4;
589 /*
590 * For some reason exportfs has been passing down an
591 * invalid (-1) uid & gid on the "dummy" export which it
592 * uses to test export support. To make sure exportfs
593 * sees errors from check_export we therefore need to
594 * delay these checks till after check_export:
595 */
596 err = -EINVAL;
597 if (!uid_valid(exp.ex_anon_uid))
598 goto out4;
599 if (!gid_valid(exp.ex_anon_gid))
600 goto out4;
601 err = 0;
586 } 602 }
587 603
588 expp = svc_export_lookup(&exp); 604 expp = svc_export_lookup(&exp);