summaryrefslogtreecommitdiff
path: root/fs/gfs2/log.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2019-11-14 09:49:11 -0500
committerAndreas Gruenbacher <agruenba@redhat.com>2019-11-14 16:51:00 +0100
commitfe5e7ba11fcf1d75af8173836309e8562aefedef (patch)
treec10085dc5073f46c1472d98d12106f7e21dc523d /fs/gfs2/log.c
parentfeed98a8e5f3e54a8c41a3b26aa914db5d7e3c18 (diff)
gfs2: fix glock reference problem in gfs2_trans_remove_revoke
Commit 9287c6452d2b fixed a situation in which gfs2 could use a glock after it had been freed. To do that, it temporarily added a new glock reference by calling gfs2_glock_hold in function gfs2_add_revoke. However, if the bd element was removed by gfs2_trans_remove_revoke, it failed to drop the additional reference. This patch adds logic to gfs2_trans_remove_revoke to properly drop the additional glock reference. Fixes: 9287c6452d2b ("gfs2: Fix occasional glock use-after-free") Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r--fs/gfs2/log.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 4a7713c62f04..68af71eb28c6 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -611,6 +611,14 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
list_add(&bd->bd_list, &sdp->sd_log_revokes);
}
+void gfs2_glock_remove_revoke(struct gfs2_glock *gl)
+{
+ if (atomic_dec_return(&gl->gl_revokes) == 0) {
+ clear_bit(GLF_LFLUSH, &gl->gl_flags);
+ gfs2_glock_queue_put(gl);
+ }
+}
+
void gfs2_write_revokes(struct gfs2_sbd *sdp)
{
struct gfs2_trans *tr;