Commit 4740d747 authored by Al Viro's avatar Al Viro Committed by Stefan Bader

getname_kernel() needs to make sure that ->name != ->iname in long case

BugLink: http://bugs.launchpad.net/bugs/1768429

commit 30ce4d19 upstream.

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

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent fb6d6337
...@@ -220,9 +220,10 @@ getname_kernel(const char * filename) ...@@ -220,9 +220,10 @@ getname_kernel(const char * filename)
if (len <= EMBEDDED_NAME_MAX) { if (len <= EMBEDDED_NAME_MAX) {
result->name = (char *)result->iname; result->name = (char *)result->iname;
} else if (len <= PATH_MAX) { } else if (len <= PATH_MAX) {
const size_t size = offsetof(struct filename, iname[1]);
struct filename *tmp; struct filename *tmp;
tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); tmp = kmalloc(size, GFP_KERNEL);
if (unlikely(!tmp)) { if (unlikely(!tmp)) {
__putname(result); __putname(result);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment