kernel - mlockall: Return EINVAL for invalid flags combinations.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Sun, 5 Dec 2010 04:40:22 +0000 (20:40 -0800)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Sun, 5 Dec 2010 04:40:22 +0000 (20:40 -0800)
Reported by: swildner

sys/vm/vm_mmap.c

index 9409a97..1c0d339 100644 (file)
@@ -1031,6 +1031,9 @@ sys_mlockall(struct mlockall_args *uap)
        int how = uap->how;
        int rc = KERN_SUCCESS;
 
+       if (((how & MCL_CURRENT) == 0) && ((how & MCL_FUTURE) == 0))
+               return (EINVAL);
+
        rc = priv_check_cred(td->td_ucred, PRIV_ROOT, 0);
        if (rc) 
                return (rc);