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>
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 278371c..090dd48 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -101,8 +101,10 @@
/* 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 @@
}
kfree(path);
}
+out:
mutex_unlock(&dirlock);
return err;
}