]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
zfs: fix function 'zlib_decompress' pointlessly calling itself
authorWHR <whr@rivoreo.one>
Tue, 30 Apr 2024 16:40:38 +0000 (00:40 +0800)
committerTom Rini <trini@konsulko.com>
Mon, 13 May 2024 22:51:13 +0000 (16:51 -0600)
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>
fs/zfs/zfs.c

index 06221e68b3505432c079d35d74a6accab376c94d..9906d553fa61df9aad7056f870d8546a0ccfbfb8 100644 (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;
 }