Skip to content

Commit 7d9b862

Browse files
committed
ovl: fix use inode directly in rcu-walk mode
jira LE-3201 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.42.1.rt7.383.el8_10 commit-author Chen Zhongjin <[email protected]> commit 672e426 ovl_dentry_revalidate_common() can be called in rcu-walk mode. As document said, "in rcu-walk mode, d_parent and d_inode should not be used without care". Check inode here to protect access under rcu-walk mode. Fixes: bccece1 ("ovl: allow remote upper") Reported-and-tested-by: [email protected] Signed-off-by: Chen Zhongjin <[email protected]> Cc: <[email protected]> # v5.7 Signed-off-by: Miklos Szeredi <[email protected]> (cherry picked from commit 672e426) Signed-off-by: Jonathan Maple <[email protected]>
1 parent be93348 commit 7d9b862

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fs/overlayfs/super.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,16 @@ static int ovl_dentry_revalidate_common(struct dentry *dentry,
141141
unsigned int flags, bool weak)
142142
{
143143
struct ovl_entry *oe = dentry->d_fsdata;
144+
struct inode *inode = d_inode_rcu(dentry);
144145
struct dentry *upper;
145146
unsigned int i;
146147
int ret = 1;
147148

148-
upper = ovl_dentry_upper(dentry);
149+
/* Careful in RCU mode */
150+
if (!inode)
151+
return -ECHILD;
152+
153+
upper = ovl_i_dentry_upper(inode);
149154
if (upper)
150155
ret = ovl_revalidate_real(upper, flags, weak);
151156

0 commit comments

Comments
 (0)