aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pnode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-01-15 17:49:25 +0000
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2016-03-18 01:51:05 +0100
commitf690db8f59b86ff186e5f818b1340156d74430ad (patch)
tree92375dca3b3de67c987497d117c7ec98852286ca /fs/pnode.c
parentf26d42b0666bf6b3dba8aecfa4fe49f969fadc8a (diff)
downloadkernel_samsung_smdk4412-f690db8f59b86ff186e5f818b1340156d74430ad.zip
kernel_samsung_smdk4412-f690db8f59b86ff186e5f818b1340156d74430ad.tar.gz
kernel_samsung_smdk4412-f690db8f59b86ff186e5f818b1340156d74430ad.tar.bz2
vfs: new internal helper: mnt_has_parent(mnt)
vfsmounts have ->mnt_parent pointing either to a different vfsmount or to itself; it's never NULL and termination condition in loops traversing the tree towards root is mnt == mnt->mnt_parent. At least one place (see the next patch) is confused about what's going on; let's add an explicit helper checking it right way and use it in all places where we need it. Not that there had been too many, but... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> (cherry picked from commit b2dba1af3c4157040303a76d25216b1713d333d0) CVE-2014-7970 BugLink: http://bugs.launchpad.net/bugs/1383356 Signed-off-by: Luis Henriques <luis.henriques@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andy Whitcroft <apw@canonical.com> Change-Id: Iaa5ab510804f3b17fe71197b8919d663a416bf05
Diffstat (limited to 'fs/pnode.c')
-rw-r--r--fs/pnode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/pnode.c b/fs/pnode.c
index d42514e..f1cd958 100644
--- a/fs/pnode.c
+++ b/fs/pnode.c
@@ -36,7 +36,7 @@ static inline struct vfsmount *next_slave(struct vfsmount *p)
static bool is_path_reachable(struct vfsmount *mnt, struct dentry *dentry,
const struct path *root)
{
- while (mnt != root->mnt && mnt->mnt_parent != mnt) {
+ while (mnt != root->mnt && mnt_has_parent(mnt)) {
dentry = mnt->mnt_mountpoint;
mnt = mnt->mnt_parent;
}