aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-12-22 16:25:16 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-23 14:23:44 -0500
commit8042273801059884da2d53bbca34575d090b6f4e (patch)
treebc888394726172c0a489fd8bfa18b551272cbe69 /drivers/base
parent0787fdf70ba4c41a3350096ebaa347a17e900385 (diff)
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')
-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)
101 101
102 /* parent directories do not exist, create them */ 102 /* parent directories do not exist, create them */
103 path = kstrdup(nodepath, GFP_KERNEL); 103 path = kstrdup(nodepath, GFP_KERNEL);
104 if (!path) 104 if (!path) {
105 return -ENOMEM; 105 err = -ENOMEM;
106 goto out;
107 }
106 s = path; 108 s = path;
107 for (;;) { 109 for (;;) {
108 s = strchr(s, '/'); 110 s = strchr(s, '/');
@@ -117,6 +119,7 @@ static int create_path(const char *nodepath)
117 } 119 }
118 kfree(path); 120 kfree(path);
119 } 121 }
122out:
120 mutex_unlock(&dirlock); 123 mutex_unlock(&dirlock);
121 return err; 124 return err;
122} 125}