From patchwork Tue Apr 30 16:40:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WHR X-Patchwork-Id: 1929725 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTQtb0WFdz20fY for ; Wed, 1 May 2024 02:40:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 186F288519; Tue, 30 Apr 2024 18:40:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=rivoreo.one Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 87D5688518; Tue, 30 Apr 2024 18:40:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: ** X-Spam-Status: No, score=2.9 required=5.0 tests=BAYES_00, RCVD_IN_PBL, RDNS_NONE, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from tianjin2.rivoreo.one (unknown [60.25.139.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 82447888E6 for ; Tue, 30 Apr 2024 18:40:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=rivoreo.one Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=whr@rivoreo.one Received: from [10.1.105.1] (localhost [127.0.0.1]) by tianjin2.rivoreo.one (Postfix) with ESMTP id C072772168; Wed, 1 May 2024 00:40:38 +0800 (CST) Received: from 10.1.107.31 (SquirrelMail authenticated user whr) by _ with HTTP; Wed, 1 May 2024 00:40:38 +0800 Message-ID: Date: Wed, 1 May 2024 00:40:38 +0800 Subject: [PATCH] zfs: fix function 'zlib_decompress' pointlessly calling itself From: "WHR" To: u-boot@lists.denx.de Cc: "Tom Rini" , mwleeds@mailtundra.com User-Agent: SquirrelMail/1.4.23 [SVN] MIME-Version: 1.0 X-Priority: 3 (Normal) Importance: Normal X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 --- v2: Resubmit with diff content in plain text. 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 #include #include +#include #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; }