This is a note to let you know that I've just added the patch titled erofs: fix error handling in z_erofs_init_decompressor to the 6.11-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: erofs-fix-error-handling-in-z_erofs_init_decompresso.patch and it can be found in the queue-6.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 40cdae011842e0974084935a5d128771468f5625 Author: Sandeep Dhavale <dhavale@xxxxxxxxxx> Date: Wed Sep 4 23:00:25 2024 -0700 erofs: fix error handling in z_erofs_init_decompressor [ Upstream commit 3fc3e45fcdeaad4b7660b560fcbc827eb733f58e ] If we get a failure at the first decompressor init (i = 0), the clean up while loop could enter infinite loop due to wrong while check. Check the value of i now to see if we need any clean up at all. Fixes: 5a7cce827ee9 ("erofs: refine z_erofs_{init,exit}_subsystem()") Reported-by: liujinbao1 <liujinbao1@xxxxxxxxxx> Signed-off-by: Sandeep Dhavale <dhavale@xxxxxxxxxx> Reviewed-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Reviewed-by: Chao Yu <chao@xxxxxxxxxx> Link: https://lore.kernel.org/r/20240905060027.2388893-1-dhavale@xxxxxxxxxx Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index c2253b6a54164..eb318c7ddd80e 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -539,7 +539,7 @@ int __init z_erofs_init_decompressor(void) for (i = 0; i < Z_EROFS_COMPRESSION_MAX; ++i) { err = z_erofs_decomp[i] ? z_erofs_decomp[i]->init() : 0; if (err) { - while (--i) + while (i--) if (z_erofs_decomp[i]) z_erofs_decomp[i]->exit(); return err;