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>
This commit is contained in:
Kay Sievers 2009-12-22 22:25:16 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 0787fdf70b
Коммит 8042273801
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

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