]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
getname_kernel() needs to make sure that ->name != ->iname in long case
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 8 Apr 2018 15:57:10 +0000 (11:57 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 8 Apr 2018 15:57:10 +0000 (11:57 -0400)
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>
fs/namei.c

index 6e0f6eea98960fbaf79357ae56d2425c7e224d15..3aefcf74f041e41bcdcf7e2c7687d92334af60f5 100644 (file)
@@ -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);