Skip to content

Commit 30ce4d1

Browse files
author
Al Viro
committed
getname_kernel() needs to make sure that ->name != ->iname in long case
missed it in "kill struct filename.separate" several years ago. Cc: [email protected] Signed-off-by: Al Viro <[email protected]>
1 parent 8613a20 commit 30ce4d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ getname_kernel(const char * filename)
222222
if (len <= EMBEDDED_NAME_MAX) {
223223
result->name = (char *)result->iname;
224224
} else if (len <= PATH_MAX) {
225+
const size_t size = offsetof(struct filename, iname[1]);
225226
struct filename *tmp;
226227

227-
tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
228+
tmp = kmalloc(size, GFP_KERNEL);
228229
if (unlikely(!tmp)) {
229230
__putname(result);
230231
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)