Commit de0143e5 authored by Al Viro's avatar Al Viro Committed by Kleber Sacilotto de Souza

root dentries need RCU-delayed freeing

BugLink: https://bugs.launchpad.net/bugs/1792174

commit 90bad5e0 upstream.

Since mountpoint crossing can happen without leaving lazy mode,
root dentries do need the same protection against having their
memory freed without RCU delay as everything else in the tree.

It's partially hidden by RCU delay between detaching from the
mount tree and dropping the vfsmount reference, but the starting
point of pathwalk can be on an already detached mount, in which
case umount-caused RCU delay has already passed by the time the
lazy pathwalk grabs rcu_read_lock().  If the starting point
happens to be at the root of that vfsmount *and* that vfsmount
covers the entire filesystem, we get trouble.

Fixes: 48a066e7 ("RCU'd vsfmounts")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent e571c92c
...@@ -1955,10 +1955,12 @@ struct dentry *d_make_root(struct inode *root_inode) ...@@ -1955,10 +1955,12 @@ struct dentry *d_make_root(struct inode *root_inode)
static const struct qstr name = QSTR_INIT("/", 1); static const struct qstr name = QSTR_INIT("/", 1);
res = __d_alloc(root_inode->i_sb, &name); res = __d_alloc(root_inode->i_sb, &name);
if (res) if (res) {
res->d_flags |= DCACHE_RCUACCESS;
d_instantiate(res, root_inode); d_instantiate(res, root_inode);
else } else {
iput(root_inode); iput(root_inode);
}
} }
return res; return res;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment