Commit fa7fe7af authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

USB: fix testing the wrong variable in fs_create_by_name()

There is a typo here.  We should be testing "*dentry" which was just
assigned instead of "dentry".  This could result in dereferencing an
ERR_PTR inside either usbfs_mkdir() or usbfs_create().
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1d0f11b3
...@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode, ...@@ -515,13 +515,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
*dentry = NULL; *dentry = NULL;
mutex_lock(&parent->d_inode->i_mutex); mutex_lock(&parent->d_inode->i_mutex);
*dentry = lookup_one_len(name, parent, strlen(name)); *dentry = lookup_one_len(name, parent, strlen(name));
if (!IS_ERR(dentry)) { if (!IS_ERR(*dentry)) {
if ((mode & S_IFMT) == S_IFDIR) if ((mode & S_IFMT) == S_IFDIR)
error = usbfs_mkdir (parent->d_inode, *dentry, mode); error = usbfs_mkdir (parent->d_inode, *dentry, mode);
else else
error = usbfs_create (parent->d_inode, *dentry, mode); error = usbfs_create (parent->d_inode, *dentry, mode);
} else } else
error = PTR_ERR(dentry); error = PTR_ERR(*dentry);
mutex_unlock(&parent->d_inode->i_mutex); mutex_unlock(&parent->d_inode->i_mutex);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment