From: "WHR" <whr@rivoreo.one>
To: u-boot@lists.denx.de
Cc: "Tom Rini" <trini@konsulko.com>, mwleeds@mailtundra.com
Subject: [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself
Date: Wed, 1 May 2024 00:40:38 +0800 [thread overview]
Message-ID: <f1c277becf620ba6fd949758704076ce.squirrel@_> (raw)
[-- 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;
}
next reply other threads:[~2024-04-30 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 16:40 WHR [this message]
2024-05-14 16:15 ` [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself Tom Rini
-- strict thread matches above, loose matches on Subject: below --
2024-04-30 9:57 whr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1c277becf620ba6fd949758704076ce.squirrel@_ \
--to=whr@rivoreo.one \
--cc=mwleeds@mailtundra.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).