Skip to content

Commit d4f9744

Browse files
Dan Carpentergregkh
authored andcommitted
GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next
[ Upstream commit 14d37564fa3dc4e5d4c6828afcd26ac14e6796c5 ] This patch fixes a place where function gfs2_glock_iter_next can reference an invalid error pointer. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 11bf4a8 commit d4f9744

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

fs/gfs2/glock.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,16 +1798,18 @@ void gfs2_glock_exit(void)
17981798

17991799
static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
18001800
{
1801-
do {
1802-
gi->gl = rhashtable_walk_next(&gi->hti);
1801+
while ((gi->gl = rhashtable_walk_next(&gi->hti))) {
18031802
if (IS_ERR(gi->gl)) {
18041803
if (PTR_ERR(gi->gl) == -EAGAIN)
18051804
continue;
18061805
gi->gl = NULL;
1806+
return;
18071807
}
1808-
/* Skip entries for other sb and dead entries */
1809-
} while ((gi->gl) && ((gi->sdp != gi->gl->gl_name.ln_sbd) ||
1810-
__lockref_is_dead(&gi->gl->gl_lockref)));
1808+
/* Skip entries for other sb and dead entries */
1809+
if (gi->sdp == gi->gl->gl_name.ln_sbd &&
1810+
!__lockref_is_dead(&gi->gl->gl_lockref))
1811+
return;
1812+
}
18111813
}
18121814

18131815
static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)

0 commit comments

Comments
 (0)