security: testing the wrong variable in create_by_name()
Subsystems (2)
PATCH 1/1 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 <[email protected]>
security/inode.c +2 -2
@@ -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;
James Morris
maintainerQuoted 5 lines · Dan Carpenter
There is a typo here. We should be testing "*dentry" instead of "dentry". If "*dentry" is an
ERR_PTR, it gets dereferenced in eithermkdir()orcreate()which would cause an OOPs.Signed-off-by Dan Carpenter <[email protected]>
Looks correct -- queued for Linus.
Quoted 22 lines
security/inode.c +2
-2@@ -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;
Signature · 2 lines
James Morris <[email protected]>