Skip to content

Commit

Permalink
devtmpfs: unlock mutex in case of string allocation error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Dec 23, 2009
1 parent 0787fdf commit 8042273
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/base/devtmpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, '/');
Expand All @@ -117,6 +119,7 @@ static int create_path(const char *nodepath)
}
kfree(path);
}
out:
mutex_unlock(&dirlock);
return err;
}
Expand Down

0 comments on commit 8042273

Please sign in to comment.