Commit c076cbf2 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

mnt: Fix the error check in __detach_mounts

commit f53e5797 upstream.

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.
Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 20e62ee6
......@@ -1518,7 +1518,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();
......
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