summaryrefslogtreecommitdiffstats
path: root/drivers/base/devtmpfs.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-12-22 22:25:16 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-23 20:23:44 +0100
commit8042273801059884da2d53bbca34575d090b6f4e (patch)
treebc888394726172c0a489fd8bfa18b551272cbe69 /drivers/base/devtmpfs.c
parentDriver core: export platform_device_register_data as a GPL symbol (diff)
downloadlinux-8042273801059884da2d53bbca34575d090b6f4e.tar.xz
linux-8042273801059884da2d53bbca34575d090b6f4e.zip
devtmpfs: unlock mutex in case of string allocation error
Reported-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/devtmpfs.c')
-rw-r--r--drivers/base/devtmpfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 278371c7bf5a..090dd4851301 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -101,8 +101,10 @@ static int create_path(const char *nodepath)
/* parent directories do not exist, create them */
path = kstrdup(nodepath, GFP_KERNEL);
- if (!path)
- return -ENOMEM;
+ if (!path) {
+ err = -ENOMEM;
+ goto out;
+ }
s = path;
for (;;) {
s = strchr(s, '/');
@@ -117,6 +119,7 @@ static int create_path(const char *nodepath)
}
kfree(path);
}
+out:
mutex_unlock(&dirlock);
return err;
}