]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mnt: Fix the error check in __detach_mounts
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 19 Jan 2015 17:48:45 +0000 (11:48 -0600)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 28 Jun 2015 17:39:24 +0000 (13:39 -0400)
[ Upstream commit f53e57975151f54ad8caa1b0ac8a78091cd5700a ]

lookup_mountpoint can return either NULL or an error value.
Update the test in __detach_mounts to test for an error value
to avoid pathological cases causing a NULL pointer dereferences.

The callers of __detach_mounts should prevent it from ever being
called on an unlinked dentry but don't take any chances.

Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/namespace.c

index 8b60287a488bc480623b879f2d0f63785b98cd80..a19d05c4ebe5fb470ffc5c8eb99b07722877d5de 100644 (file)
@@ -1490,7 +1490,7 @@ void __detach_mounts(struct dentry *dentry)
 
        namespace_lock();
        mp = lookup_mountpoint(dentry);
-       if (!mp)
+       if (IS_ERR_OR_NULL(mp))
                goto out_unlock;
 
        lock_mount_hash();