Skip to content

Commit 960534a

Browse files
Al Virogregkh
Al Viro
authored andcommitted
getname_kernel() needs to make sure that ->name != ->iname in long case
commit 30ce4d1 upstream. missed it in "kill struct filename.separate" several years ago. Cc: [email protected] Signed-off-by: Al Viro <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d6bcc21 commit 960534a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/namei.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ getname_kernel(const char * filename)
221221
if (len <= EMBEDDED_NAME_MAX) {
222222
result->name = (char *)result->iname;
223223
} else if (len <= PATH_MAX) {
224+
const size_t size = offsetof(struct filename, iname[1]);
224225
struct filename *tmp;
225226

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

0 commit comments

Comments
 (0)