diff options
author | Dan Carpenter <error27@gmail.com> | 2010-04-22 12:05:35 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-12 15:03:06 -0700 |
commit | 4933574421fa12c89c29f95a57c6969be8c9e2d3 (patch) | |
tree | c3de1e9a722dd02381d1c42d7a77482512309bbb | |
parent | 70935714dcaf540b6b10328270948a0cda85ab18 (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>
-rw-r--r-- | security/inode.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/inode.c b/security/inode.c index c3a793881d0..1c812e87450 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; |