aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-04-22 06:05:35 -0400
committerJames Morris <jmorris@namei.org>2010-04-22 07:17:41 -0400
commitb338cc8207eae46640a8d534738fda7b5e48511d (patch)
tree13ce72ed8e2a83ce127c3380ba0a7084591db3ab
parente134d200d57d43b171dcb0b55c178a1a0c7db14a (diff)
security: testing the wrong variable in create_by_name()
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>
-rw-r--r--security/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/inode.c b/security/inode.c
index c3a793881d04..1c812e874504 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -161,13 +161,13 @@ static int create_by_name(const char *name, mode_t mode,
161 161
162 mutex_lock(&parent->d_inode->i_mutex); 162 mutex_lock(&parent->d_inode->i_mutex);
163 *dentry = lookup_one_len(name, parent, strlen(name)); 163 *dentry = lookup_one_len(name, parent, strlen(name));
164 if (!IS_ERR(dentry)) { 164 if (!IS_ERR(*dentry)) {
165 if ((mode & S_IFMT) == S_IFDIR) 165 if ((mode & S_IFMT) == S_IFDIR)
166 error = mkdir(parent->d_inode, *dentry, mode); 166 error = mkdir(parent->d_inode, *dentry, mode);
167 else 167 else
168 error = create(parent->d_inode, *dentry, mode); 168 error = create(parent->d_inode, *dentry, mode);
169 } else 169 } else
170 error = PTR_ERR(dentry); 170 error = PTR_ERR(*dentry);
171 mutex_unlock(&parent->d_inode->i_mutex); 171 mutex_unlock(&parent->d_inode->i_mutex);
172 172
173 return error; 173 return error;