mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
fs: Fix filename init after recent refactoring
getname_flags() should save __user pointer "filename" in filename->uptr.
However, this logic is broken by a recent refactoring. Fix it by passing
__user pointer filename to helper initname().
Fixes: 611851010c ("fs: dedup handling of struct filename init and refcounts bumps")
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/20250409220534.3635801-1-song@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
40cb48eba3
commit
b463d7fd11
|
|
@ -125,9 +125,9 @@
|
|||
|
||||
#define EMBEDDED_NAME_MAX (PATH_MAX - offsetof(struct filename, iname))
|
||||
|
||||
static inline void initname(struct filename *name)
|
||||
static inline void initname(struct filename *name, const char __user *uptr)
|
||||
{
|
||||
name->uptr = NULL;
|
||||
name->uptr = uptr;
|
||||
name->aname = NULL;
|
||||
atomic_set(&name->refcnt, 1);
|
||||
}
|
||||
|
|
@ -210,7 +210,7 @@ getname_flags(const char __user *filename, int flags)
|
|||
return ERR_PTR(-ENAMETOOLONG);
|
||||
}
|
||||
}
|
||||
initname(result);
|
||||
initname(result, filename);
|
||||
audit_getname(result);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ struct filename *getname_kernel(const char * filename)
|
|||
return ERR_PTR(-ENAMETOOLONG);
|
||||
}
|
||||
memcpy((char *)result->name, filename, len);
|
||||
initname(result);
|
||||
initname(result, NULL);
|
||||
audit_getname(result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user