Skip to content

Commit

Permalink
getname_kernel() needs to make sure that ->name != ->iname in long case
Browse files Browse the repository at this point in the history
commit 30ce4d1 upstream.

missed it in "kill struct filename.separate" several years ago.

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Al Viro authored and gregkh committed Apr 19, 2018
1 parent 84f086e commit 4eb2f39
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ getname_kernel(const char * filename)
if (len <= EMBEDDED_NAME_MAX) {
result->name = (char *)result->iname;
} else if (len <= PATH_MAX) {
const size_t size = offsetof(struct filename, iname[1]);
struct filename *tmp;

tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
tmp = kmalloc(size, GFP_KERNEL);
if (unlikely(!tmp)) {
__putname(result);
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit 4eb2f39

Please sign in to comment.