mnt: Fix the error check in __detach_mounts

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>
This commit is contained in:
Eric W. Biederman 2015-01-19 11:48:45 -06:00
parent ce07d891a0
commit f53e579751

View File

@ -1516,7 +1516,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();