Skip to content

Commit 496530c

Browse files
committed
erofs: avoid debugging output for (de)compressed data
Syzbot reported a KMSAN warning, erofs: (device loop0): z_erofs_lz4_decompress_mem: failed to decompress -12 in[46, 4050] out[917] ===================================================== BUG: KMSAN: uninit-value in hex_dump_to_buffer+0xae9/0x10f0 lib/hexdump.c:194 .. print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276 z_erofs_lz4_decompress_mem fs/erofs/decompressor.c:252 [inline] z_erofs_lz4_decompress+0x257e/0x2a70 fs/erofs/decompressor.c:311 z_erofs_decompress_pcluster fs/erofs/zdata.c:1290 [inline] z_erofs_decompress_queue+0x338c/0x6460 fs/erofs/zdata.c:1372 z_erofs_runqueue+0x36cd/0x3830 z_erofs_read_folio+0x435/0x810 fs/erofs/zdata.c:1843 The root cause is that the printed decompressed buffer may be filled incompletely due to decompression failure. Since they were once only used for debugging, get rid of them now. Reported-and-tested-by: [email protected] Closes: https://lore.kernel.org/r/[email protected] Reviewed-by: Yue Hu <[email protected]> Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 652cdaa commit 496530c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

fs/erofs/decompressor.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,9 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx,
247247
if (ret != rq->outputsize) {
248248
erofs_err(rq->sb, "failed to decompress %d in[%u, %u] out[%u]",
249249
ret, rq->inputsize, inputmargin, rq->outputsize);
250-
251-
print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET,
252-
16, 1, src + inputmargin, rq->inputsize, true);
253-
print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET,
254-
16, 1, out, rq->outputsize, true);
255-
256250
if (ret >= 0)
257251
memset(out + ret, 0, rq->outputsize - ret);
258-
ret = -EIO;
252+
ret = -EFSCORRUPTED;
259253
} else {
260254
ret = 0;
261255
}

0 commit comments

Comments
 (0)