From: Kay Sievers Date: Tue, 22 Dec 2009 21:25:16 +0000 (+0100) Subject: devtmpfs: unlock mutex in case of string allocation error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8042273801059884da2d53bbca34575d090b6f4e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git devtmpfs: unlock mutex in case of string allocation error Reported-by: Kirill A. Shutemov Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- 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; }