Merge tag 'renesas-fixes-for-v3.13' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / fs / nfsd / export.c
index 5f38ea36e266751f700b806bd4b4dfb7c6ed0dcd..8513c598fabfbb7cc83e32357d4ff0f6ba8e087d 100644 (file)
@@ -536,16 +536,12 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
                if (err)
                        goto out3;
                exp.ex_anon_uid= make_kuid(&init_user_ns, an_int);
-               if (!uid_valid(exp.ex_anon_uid))
-                       goto out3;
 
                /* anon gid */
                err = get_int(&mesg, &an_int);
                if (err)
                        goto out3;
                exp.ex_anon_gid= make_kgid(&init_user_ns, an_int);
-               if (!gid_valid(exp.ex_anon_gid))
-                       goto out3;
 
                /* fsid */
                err = get_int(&mesg, &an_int);
@@ -583,6 +579,26 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
                                   exp.ex_uuid);
                if (err)
                        goto out4;
+               /*
+                * No point caching this if it would immediately expire.
+                * Also, this protects exportfs's dummy export from the
+                * anon_uid/anon_gid checks:
+                */
+               if (exp.h.expiry_time < seconds_since_boot())
+                       goto out4;
+               /*
+                * For some reason exportfs has been passing down an
+                * invalid (-1) uid & gid on the "dummy" export which it
+                * uses to test export support.  To make sure exportfs
+                * sees errors from check_export we therefore need to
+                * delay these checks till after check_export:
+                */
+               err = -EINVAL;
+               if (!uid_valid(exp.ex_anon_uid))
+                       goto out4;
+               if (!gid_valid(exp.ex_anon_gid))
+                       goto out4;
+               err = 0;
        }
 
        expp = svc_export_lookup(&exp);
This page took 0.039853 seconds and 5 git commands to generate.