* [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself
@ 2024-04-30 9:57 whr
0 siblings, 0 replies; 3+ messages in thread
From: whr @ 2024-04-30 9:57 UTC (permalink / raw)
To: u-boot; +Cc: Tom Rini, mwleeds
[-- Attachment #1: Type: text/plain, Size: 178 bytes --]
To prevent crashing due infinite recursion and actually decompress the
requested data, call the zlib function 'uncompress' instead.
Signed-off-by: WHR <msl0000023508@gmail.com>
[-- Attachment #2: 0001-zfs-fix-function-zlib_decompress-pointlessly-calling --]
[-- Type: /, Size: 565 bytes --]
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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself
@ 2024-04-30 16:40 WHR
2024-05-14 16:15 ` Tom Rini
0 siblings, 1 reply; 3+ messages in thread
From: WHR @ 2024-04-30 16:40 UTC (permalink / raw)
To: u-boot; +Cc: Tom Rini, mwleeds
[-- Attachment #1: Type: text/plain, Size: 242 bytes --]
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>
---
v2:
Resubmit with diff content in plain text.
[-- Attachment #2: 0001-zfs-fix-function-zlib_decompress-pointlessly-calling --]
[-- Type: text/plain, Size: 564 bytes --]
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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself
2024-04-30 16:40 WHR
@ 2024-05-14 16:15 ` Tom Rini
0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2024-05-14 16:15 UTC (permalink / raw)
To: WHR; +Cc: u-boot, mwleeds
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
On Wed, May 01, 2024 at 12:40:38AM +0800, WHR wrote:
> 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>
Applied to u-boot/next, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-14 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30 9:57 [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself whr
-- strict thread matches above, loose matches on Subject: below --
2024-04-30 16:40 WHR
2024-05-14 16:15 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox