aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-04-22 12:00:52 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-26 14:27:07 -0700
commitd130b918879aa06a82cfac3bec5ec88e79a05f30 (patch)
tree8b839afc6a34a207be2fbee4a0a1a16d53dcece8 /drivers
parentdc116e1abdbfe4afc934e62c42f1963806469e6b (diff)
USB: fix testing the wrong variable in fs_create_by_name()
commit fa7fe7af146a7b613e36a311eefbbfb5555325d1 upstream. 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: Dan Carpenter <error27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 83887ffff44..2c3cdbd71df 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -510,13 +510,13 @@ static int fs_create_by_name (const char *name, mode_t mode,
*dentry = NULL;
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 = usbfs_mkdir (parent->d_inode, *dentry, mode);
else
error = usbfs_create (parent->d_inode, *dentry, mode);
} else
- error = PTR_ERR(dentry);
+ error = PTR_ERR(*dentry);
mutex_unlock(&parent->d_inode->i_mutex);
return error;