From 1466e065a94b3cd242f945f16c916a7f7da02985 Mon Sep 17 00:00:00 2001 From: WHR Date: Wed, 1 May 2024 00:40:38 +0800 Subject: [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself In order to prevent crashing due to infinite recursion and actually decompress the requested data, call the zlib function 'uncompress' instead. Signed-off-by: WHR --- fs/zfs/zfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c index 06221e68b3..9906d553fa 100644 --- a/fs/zfs/zfs.c +++ b/fs/zfs/zfs.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "zfs_common.h" #include "div64.h" @@ -182,7 +183,8 @@ static int zlib_decompress(void *s, void *d, uint32_t slen, uint32_t dlen) { - if (zlib_decompress(s, d, slen, dlen) < 0) + uLongf z_dest_len = dlen; + if (uncompress(d, &z_dest_len, s, slen) != Z_OK) return ZFS_ERR_BAD_FS; return ZFS_ERR_NONE; } -- 2.39.5