Skip to content

Commit a5585d0

Browse files
dhavalehsiangkao
authored andcommitted
erofs: fix error handling in z_erofs_init_decompressor
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: 5a7cce8 ("erofs: refine z_erofs_{init,exit}_subsystem()") Reported-by: liujinbao1 <[email protected]> Signed-off-by: Sandeep Dhavale <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Reviewed-by: Chao Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent ee7ac1a commit a5585d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/erofs/decompressor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ int __init z_erofs_init_decompressor(void)
539539
for (i = 0; i < Z_EROFS_COMPRESSION_MAX; ++i) {
540540
err = z_erofs_decomp[i] ? z_erofs_decomp[i]->init() : 0;
541541
if (err) {
542-
while (--i)
542+
while (i--)
543543
if (z_erofs_decomp[i])
544544
z_erofs_decomp[i]->exit();
545545
return err;

0 commit comments

Comments
 (0)