projects/linux·commit 80422738

devtmpfs: unlock mutex in case of string allocation error

80422738 · Kay Sievers <[email protected]> · 2009-12-22 22:25:16 +01:00

Reported-by: Kirill A. Shutemov <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Commit
8042273801059884da2d53bbca34575d090b6f4e
Parents
0787fdf7

Changes

1 files changed · +5 −2

FileStatusAddDelContent
drivers/base/devtmpfs.cmodified+5−2View file

drivers/base/devtmpfs.c

View file
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 @@ 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;
}