aboutsummaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-04-22 12:05:35 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-12 14:57:14 -0700
commite3a126e62222b90f6c9ec63cc30cf443210764f7 (patch)
tree9facd8803797b1711f18bf88969135b320fc0f4e /security
parent8faa545b70aa50bcb01a7baa113341ba1dff2fc3 (diff)
security: testing the wrong variable in create_by_name()
commit b338cc8207eae46640a8d534738fda7b5e48511d upstream. 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> Signed-off-by: James Morris <jmorris@namei.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'security')
-rw-r--r--security/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/inode.c b/security/inode.c
index f7496c6a022..3d78d69a629 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -168,13 +168,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;