提交 80422738 编写于 作者: K Kay Sievers 提交者: Greg Kroah-Hartman

devtmpfs: unlock mutex in case of string allocation error

Reported-by: NKirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 0787fdf7
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册