public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] security: testing the wrong variable in create_by_name()
@ 2010-04-22 10:05 Dan Carpenter
  2010-04-22 11:18 ` [patch] security: testing the wrong variable in James Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-04-22 10:05 UTC (permalink / raw)
  To: James Morris
  Cc: Eric Paris, linux-kernel, kernel-janitors, linux-security-module

There is a typo here.  We should be testing "*dentry" instead of
"dentry".  If "*dentry" is an ERR_PTR, it gets dereferenced in either
mkdir() or create() which would cause an OOPs.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/security/inode.c b/security/inode.c
index c3a7938..1c812e8 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -161,13 +161,13 @@ static int create_by_name(const char *name, mode_t mode,
 
 	mutex_lock(&parent->d_inode->i_mutex);
 	*dentry = lookup_one_len(name, parent, strlen(name));
-	if (!IS_ERR(dentry)) {
+	if (!IS_ERR(*dentry)) {
 		if ((mode & S_IFMT) = S_IFDIR)
 			error = mkdir(parent->d_inode, *dentry, mode);
 		else
 			error = create(parent->d_inode, *dentry, mode);
 	} else
-		error = PTR_ERR(dentry);
+		error = PTR_ERR(*dentry);
 	mutex_unlock(&parent->d_inode->i_mutex);
 
 	return error;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-22 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 10:05 [patch] security: testing the wrong variable in create_by_name() Dan Carpenter
2010-04-22 11:18 ` [patch] security: testing the wrong variable in James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox