]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gfs2: Fix refcount leak in gfs2_glock_poke
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 27 Jul 2020 17:18:57 +0000 (19:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:15:02 +0000 (13:15 +0200)
commit c07bfb4d8fa1ee11c6d18b093d0bb6c8832d3626 upstream.

In gfs2_glock_poke, make sure gfs2_holder_uninit is called on the local
glock holder.  Without that, we're leaking a glock and a pid reference.

Fixes: 9e8990dea926 ("gfs2: Smarter iopen glock waiting")
Cc: stable@vger.kernel.org # v5.8+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/gfs2/glock.c

index 8545024a1401f74bfe70e1e97154a29682331715..f92876f4f37a179c9171c58bfdb551b0a3efb2ca 100644 (file)
@@ -790,9 +790,11 @@ static void gfs2_glock_poke(struct gfs2_glock *gl)
        struct gfs2_holder gh;
        int error;
 
-       error = gfs2_glock_nq_init(gl, LM_ST_SHARED, flags, &gh);
+       gfs2_holder_init(gl, LM_ST_SHARED, flags, &gh);
+       error = gfs2_glock_nq(&gh);
        if (!error)
                gfs2_glock_dq(&gh);
+       gfs2_holder_uninit(&gh);
 }
 
 static bool gfs2_try_evict(struct gfs2_glock *gl)