From kay.sievers@vrfy.org Tue Dec 22 14:05:56 2009 From: Kay Sievers Date: Tue, 22 Dec 2009 22:25:16 +0100 Subject: devtmpfs: unlock mutex in case of string allocation error To: "Kirill A. Shutemov" Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Message-ID: <1261517116.2101.2.camel@yio.site> From: Kay Sievers Reported-by: Kirill A. Shutemov Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- drivers/base/devtmpfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -101,8 +101,10 @@ static int create_path(const char *nodep /* 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 *nodep } kfree(path); } +out: mutex_unlock(&dirlock); return err; }