* [PATCH v3] erofs: fix error handling in z_erofs_init_decompressor
@ 2024-09-05 6:00 Sandeep Dhavale
2024-09-05 6:05 ` Gao Xiang
2024-09-09 6:15 ` Chao Yu
0 siblings, 2 replies; 3+ messages in thread
From: Sandeep Dhavale @ 2024-09-05 6:00 UTC (permalink / raw)
To: linux-erofs, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Sandeep Dhavale
Cc: hsiangkao, kernel-team, liujinbao1, linux-kernel
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@xiaomi.com>
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
---
v2: https://lore.kernel.org/linux-erofs/20240829122342.309611-1-jinbaoliu365@gmail.com/
v1: https://lore.kernel.org/linux-erofs/20240822062749.4012080-1-jinbaoliu365@gmail.com/
fs/erofs/decompressor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index c2253b6a5416..eb318c7ddd80 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;
--
2.46.0.469.g59c65b2a67-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] erofs: fix error handling in z_erofs_init_decompressor
2024-09-05 6:00 [PATCH v3] erofs: fix error handling in z_erofs_init_decompressor Sandeep Dhavale
@ 2024-09-05 6:05 ` Gao Xiang
2024-09-09 6:15 ` Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2024-09-05 6:05 UTC (permalink / raw)
To: Sandeep Dhavale, linux-erofs, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu
Cc: kernel-team, liujinbao1, linux-kernel
On 2024/9/5 14:00, Sandeep Dhavale wrote:
> 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@xiaomi.com>
> Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] erofs: fix error handling in z_erofs_init_decompressor
2024-09-05 6:00 [PATCH v3] erofs: fix error handling in z_erofs_init_decompressor Sandeep Dhavale
2024-09-05 6:05 ` Gao Xiang
@ 2024-09-09 6:15 ` Chao Yu
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2024-09-09 6:15 UTC (permalink / raw)
To: Sandeep Dhavale, linux-erofs, Gao Xiang, Yue Hu, Jeffle Xu
Cc: chao, hsiangkao, kernel-team, liujinbao1, linux-kernel
On 2024/9/5 14:00, Sandeep Dhavale wrote:
> 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@xiaomi.com>
> Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-09 6:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-05 6:00 [PATCH v3] erofs: fix error handling in z_erofs_init_decompressor Sandeep Dhavale
2024-09-05 6:05 ` Gao Xiang
2024-09-09 6:15 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®