patch-2.3.41 linux/fs/open.c

Next file: linux/fs/partitions/Config.in
Previous file: linux/fs/nfsd/nfsfh.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/fs/open.c linux/fs/open.c
@@ -306,11 +306,12 @@
 	struct dentry * dentry;
 	int old_fsuid, old_fsgid;
 	kernel_cap_t old_cap;
-	int res = -EINVAL;
+	int res;
+
+	if (mode & ~S_IRWXO)	/* where's F_OK, X_OK, W_OK, R_OK? */
+		return -EINVAL;
 
 	lock_kernel();
-	if (mode != (mode & S_IRWXO))	/* where's F_OK, X_OK, W_OK, R_OK? */
-		goto out;
 	old_fsuid = current->fsuid;
 	old_fsgid = current->fsgid;
 	old_cap = current->cap_effective;
@@ -337,7 +338,7 @@
 	current->fsuid = old_fsuid;
 	current->fsgid = old_fsgid;
 	current->cap_effective = old_cap;
-out:
+
 	unlock_kernel();
 	return res;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)