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 <msl0000023508@gmail.com>
This commit is contained in:
WHR 2024-05-01 00:40:38 +08:00 committed by Tom Rini
parent cd85e0d443
commit 1466e065a9

View file

@ -16,6 +16,7 @@
#include <linux/time.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
#include <u-boot/zlib.h>
#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;
}