[PATCH] walk_component(): get inode in lookup_slow branch statement block

sunliming posted 1 patch 3 years, 10 months ago
fs/namei.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] walk_component(): get inode in lookup_slow branch statement block
Posted by sunliming 3 years, 10 months ago
The inode variable is used as a parameter by the step_into function,
but is not assigned a value in the sub-lookup_slow branch path. So
get the inode in the sub-lookup_slow branch path.

Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 fs/namei.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/namei.c b/fs/namei.c
index 1f28d3f463c3..a1a3e9514f46 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2014,6 +2014,8 @@ static const char *walk_component(struct nameidata *nd, int flags)
 		dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags);
 		if (IS_ERR(dentry))
 			return ERR_CAST(dentry);
+
+		inode = d_backing_inode(dentry);
 	}
 	if (!(flags & WALK_MORE) && nd->depth)
 		put_link(nd);
-- 
2.25.1