Trig a BUG when kern_path see LOOKUP_ROOT in flag
PATCH 1/1 Trig a BUG when kern_path see LOOKUP_ROOT in flag
kern_path does not prepare for LOOKUP_ROOT, if this flag is passed down, path_init will reference uninitialized nameidata. When things go wrong, it will not be as obvious as dereferencing a null pointer. Kindly trig a bug here.
Signed-off-by Guo Chao <[email protected]>
--- fs/namei.c | 3 +++ 1 file changed, 3 insertions(+)
fs/namei.c +3 -0
@@ -1888,6 +1888,9 @@ struct dentry *kern_path_locked(const char *name, struct path *path)int kern_path (const char *name,unsigned int flags,struct path *path) {struct nameidata nd; + +BUG_ON (flags &LOOKUP_ROOT ); +int res =do_path_lookup (AT_FDCWD , name, flags, &nd);if (!res) *path = nd.path;
Signature · 1 line
1.7.9.5