]> xenbits.xensource.com Git - freebsd.git/commitdiff
vfs: fix braino resulting in NULL pointer deref in r352424
authormjg <mjg@FreeBSD.org>
Tue, 17 Sep 2019 08:09:39 +0000 (08:09 +0000)
committermjg <mjg@FreeBSD.org>
Tue, 17 Sep 2019 08:09:39 +0000 (08:09 +0000)
The breakage was added after all the testing and the testing which followed
was not sufficient to find it.

Reported by: pho
Sponsored by: The FreeBSD Foundation

sys/kern/vfs_default.c

index 163a617a3ec5cd8e7d0c3e0a8d6e02b4e1070af7..2fd95fbc8b46cba31d32067039ce950dcaeb1140 100644 (file)
@@ -613,11 +613,13 @@ vop_stdgetwritemount(ap)
                vfs_op_thread_exit(mp);
        } else {
                MNT_ILOCK(mp);
-               if (mp == vp->v_mount)
+               if (mp == vp->v_mount) {
                        MNT_REF(mp);
-               else
+                       MNT_IUNLOCK(mp);
+               } else {
+                       MNT_IUNLOCK(mp);
                        mp = NULL;
-               MNT_IUNLOCK(mp);
+               }
        }
        *(ap->a_mpp) = mp;
        return (0);