lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331155362-11132-21-git-send-email-miklos@szeredi.hu>
Date:	Wed,  7 Mar 2012 22:22:37 +0100
From:	Miklos Szeredi <miklos@...redi.hu>
To:	viro@...IV.linux.org.uk
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	hch@...radead.org, Trond.Myklebust@...app.com, sfrench@...ba.org,
	sage@...dream.net, ericvh@...il.com, mszeredi@...e.cz
Subject: [PATCH 20/25] vfs: move O_DIRECT check to common code

From: Miklos Szeredi <mszeredi@...e.cz>

Perform open_check_o_direct() in a common place in do_last after opening the
file.

Signed-off-by: Miklos Szeredi <mszeredi@...e.cz>
---
 fs/namei.c |   30 +++++++++---------------------
 1 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index fadc95c..4207e4f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2055,19 +2055,13 @@ static struct file *atomic_create(struct inode *dir, struct dentry *dentry,
 	 * here.
 	 */
 	error = may_open(&filp->f_path, MAY_OPEN, open_flag);
-	if (error)
-		goto out_fput;
-
-	error = open_check_o_direct(filp);
-	if (error)
-		goto out_fput;
+	if (error) {
+		fput(filp);
+		return ERR_PTR(error);
+	}
 
 out:
 	return filp;
-
-out_fput:
-	fput(filp);
-	return ERR_PTR(error);
 }
 
 static struct file *create_open(struct inode *dir, struct dentry *dentry,
@@ -2249,22 +2243,16 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
 		 * permission here.
 		 */
 		error = may_open(&filp->f_path, acc_mode, open_flag);
-		if (error)
-			goto out_fput;
-
-		error = open_check_o_direct(filp);
-		if (error)
-			goto out_fput;
+		if (error) {
+			fput(filp);
+			return ERR_PTR(error);
+		}
 	}
 	*create_error = 0;
 
 out:
 	return filp;
 
-out_fput:
-	fput(filp);
-	return ERR_PTR(error);
-
 look_up:
 	return NULL;
 }
@@ -2588,10 +2576,10 @@ common:
 	}
 	if (IS_ERR(filp))
 		goto out;
+opened:
 	error = open_check_o_direct(filp);
 	if (error)
 		goto exit_fput;
-opened:
 	error = ima_file_check(filp, op->acc_mode);
 	if (error)
 		goto exit_fput;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ