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)
committerEric W. Biederman <ebiederm@xmission.com>
Thu, 9 Apr 2015 16:39:56 +0000 (11:39 -0500)
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>
fs/namespace.c

index 1894d1878dbc266333d099852b4c51e6ffa71317..e8f7f8c58c3c64cacb39629db55262c922797a16 100644 (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();
This page took 0.028189 seconds and 5 git commands to generate.