[PATCH v2 040/113] fs: initialize struct nameidata::last

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 fs/fs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fs.c b/fs/fs.c
index 0ff7f1b6f947..acd89dd1c9a4 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;
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux