summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 19:59:25 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:05 +0100
commit6548e5b9ca681e833c20baf357eb9fef39c92583 (patch)
tree0abc8acd3c1753c432c6384293fe0b620ecde2fd
parent992f8aeec1322e352c1241500b3ab3ef400a2fd6 (diff)
downloadbarebox-6548e5b9ca68.tar.gz
barebox-6548e5b9ca68.tar.xz
fs: initialize struct nameidata::last
The last member is normally written by link_path_walk(), before being read by __lookup_hash, among others. In the special case of calling open() on "/", link_path_walk() will terminate early without setting the last member, leading __d_alloc called by __lookup_hash to read uninitialized memory. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-41-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--fs/fs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 0ff7f1b6f9..acd89dd1c9 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1631,6 +1631,7 @@ struct filename {
static void set_nameidata(struct nameidata *p, struct filename *name)
{
+ p->last = slash_name;
p->stack = p->internal;
p->name = name;
p->total_link_count = 0;