Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d4bafa7 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Sasha Levin
Browse files

mnt: Fix the error check in __detach_mounts



[ 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: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent f9c3700b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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();