[PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself
WHR
whr at rivoreo.one
Tue Apr 30 18:40:38 CEST 2024
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 at gmail.com>
---
v2:
Resubmit with diff content in plain text.
-------------- next part --------------
diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c
index bfc11fa667..4896cc18ef 100644
--- a/fs/zfs/zfs.c
+++ b/fs/zfs/zfs.c
@@ -17,6 +17,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"
@@ -183,7 +184,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;
}
More information about the U-Boot
mailing list