Skip to contentSkip to conversation

Patch "GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 5, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
gfs2-fix-reference-to-err_ptr-in-gfs2_glock_iter_next.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Oct 5 10:28:31 CEST 2017

From: Dan Carpenter <[email protected]>
Date: Wed, 14 Dec 2016 08:02:03 -0600
Subject: GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next

From: Dan Carpenter <[email protected]>

[ Upstream commit 14d37564fa3dc4e5d4c6828afcd26ac14e6796c5 ]

This patch fixes a place where function gfs2_glock_iter_next can reference an invalid error pointer.

---
 fs/gfs2/glock.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
fs/gfs2/glock.c +7 -5
@@ -1820,16 +1820,18 @@ void gfs2_glock_exit(void)
 
 static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
 {
-	do {
-		gi->gl = rhashtable_walk_next(&gi->hti);
+	while ((gi->gl = rhashtable_walk_next(&gi->hti))) {
 		if (IS_ERR(gi->gl)) {
 			if (PTR_ERR(gi->gl) == -EAGAIN)
 				continue;
 			gi->gl = NULL;
+			return;
 		}
-	/* Skip entries for other sb and dead entries */
-	} while ((gi->gl) && ((gi->sdp != gi->gl->gl_name.ln_sbd) ||
-			      __lockref_is_dead(&gi->gl->gl_lockref)));
+		/* Skip entries for other sb and dead entries */
+		if (gi->sdp == gi->gl->gl_name.ln_sbd &&
+		    !__lockref_is_dead(&gi->gl->gl_lockref))
+			return;
+	}
 }
 
 static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/gfs2-fix-reference-to-err_ptr-in-gfs2_glock_iter_next.patch queue-4.9/asoc-dapm-fix-some-pointer-error-handling.patch