From: Jan Kara Date: Thu, 2 Jun 2005 21:02:01 +0000 (-0700) Subject: [PATCH] ext3: fix list scanning in __cleanup_transaction X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7e3b11a9be6ac94bf4af81757b6a10e7e65b846f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] ext3: fix list scanning in __cleanup_transaction Fix a bug in list scanning that can cause us to skip the last buffer on the checkpoint list (and hence fail to do any progress under some rather unfavorable conditions). The problem is we first do jh=next_jh and then test } while (jh!=last_jh); Hence we skip the last buffer on the list (if it was not the only buffer on the list). As we already do jh=next_jh; in the beginning of the loop we are safe to just remove the assignment in the end. It can happen that 'jh' will be freed at the point we test jh != last_jh but that does not matter as we never *dereference* the pointer. Signed-off-by: Jan Kara Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index 58133ab9457e..5a97e346bd95 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c @@ -188,7 +188,6 @@ static int __cleanup_transaction(journal_t *journal, transaction_t *transaction) } else { jbd_unlock_bh_state(bh); } - jh = next_jh; } while (jh != last_jh); return ret;