From patchwork Tue Feb 23 03:49:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wagner Popov dos Santos X-Patchwork-Id: 1443383 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lSwZWqrW; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dl4mh5LFPz9sTD for ; Tue, 23 Feb 2021 14:49:20 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A851B8299C; Tue, 23 Feb 2021 04:49:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lSwZWqrW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 13BD3829B6; Tue, 23 Feb 2021 04:49:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0F50082981 for ; Tue, 23 Feb 2021 04:49:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=wpopov@gmail.com Received: by mail-qt1-x82c.google.com with SMTP id e15so10997610qte.9 for ; Mon, 22 Feb 2021 19:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:user-agent:mime-version :content-transfer-encoding; bh=/hjXSD4r03TwfsbkYCxSVKPB4pt+rNZ5i/JaLmJXe3Q=; b=lSwZWqrW89zrZ4q3fkujETOOJTlSgeRq/f+Gfr8RM6W468h6vfQbK6q6j8Nd//4xj4 vSjpsm/7vr/hFd2efZ4x/YDgu+mvoLwq3JshOcYqcgAExsN/rw4ksZ5zNDbg4ndEO9U9 FlfIdE+xRdLKFxVN04YpLrBtKuyXqywXFcp/vHX8lca0VuePTC7wMONjBQw678H+DaOO jOA4RqxliICwzNJA/lee/cXJ+LKJ4aiegLmXNuQ07hqIExhBEFq9WAWxK975ilgpP/Sg Wf502JHK1nymVxQ+PSNdRdNiTa9NAjd/gH2nUE4SCjL+j0KN7TQzrSHLQwOIAQLWsjVo 0JFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:user-agent :mime-version:content-transfer-encoding; bh=/hjXSD4r03TwfsbkYCxSVKPB4pt+rNZ5i/JaLmJXe3Q=; b=F765H5YA59nwEK8ijMj7IotsnRaVZWszWWaNkyYiq11oXFN0trK2oF6nJUx2SVaRyf OXGEHwg+/D1aO5sKFcFcXYfWhbEPemd80Zy0gxsWEP/ZG2E1meUtGWAFSOtsVeIwNolZ H7RcRHA4ji2ZKJI74Wujakz5J+rYMg3P9bs5nbsYio8EIR07tcmF9/pfolPqH6eKepAF aNs3Eqgpa6CxhwnZun47unp1HDJ1TqykE8oRGxTTCcMgmdLzwX3qCXK7JqHWLc8DCPM1 Xe/9YxekqCcWDfPyeJWSs+uOw3bG0E6ZvxeUpaZt0Ze6UvZUlylNSezLZONppqbYHSqW mmbA== X-Gm-Message-State: AOAM533DAIV5VeraeCkZysPHcyKi9ttFZU7IcTrK816YkQxKHMgCrTnU NKpJ2CoZEG87R4Hrgd1/r0Lit+Kv2W8= X-Google-Smtp-Source: ABdhPJx430N2PH1P0LccbvtmzKG44wq2Vx8kQqYCwzw/anNGbVe2wmeO7MgKSD3NJJfcs/4edMr2uA== X-Received: by 2002:a05:622a:315:: with SMTP id q21mr22822012qtw.324.1614052143395; Mon, 22 Feb 2021 19:49:03 -0800 (PST) Received: from [192.168.0.6] ([189.6.26.247]) by smtp.gmail.com with ESMTPSA id y68sm8990916qkb.76.2021.02.22.19.49.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 19:49:03 -0800 (PST) Message-ID: <77fd41b0ee01fa49e03c7bd456dd7d5bc1d75462.camel@gmail.com> Subject: [PATCH] JFFS2: fix jffs2 summary datacrc status uninitialized From: Wagner Popov dos Santos To: u-boot@lists.denx.de Date: Tue, 23 Feb 2021 00:49:00 -0300 User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean The function jffs2_1pass_read_inode() was discarding the summary inodes and dirent because the value in datacrc flag wasn't initialized in function jffs2_sum_process_sum_data(). This fix initializes the status of all summary records to indicate that the CRC needs to be verified when they are loaded. Before this fix, the behaviors produced by the undefined value of datacrc was: - Summary's registries were discarded when 'b->datacrc' is equal as 'CRC_BAD'. - Summary's registries were not checked when b->datacrc differs of 'CRC_BAD' and 'CRC_UNKNOWN' So, almost all of the time the crc just isn't checked, and in some cases the registries are discarded. Signed-off-by: Wagner Popov dos Santos --- fs/jffs2/jffs2_1pass.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index a98745c50e..c9eda54cdb 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -1276,6 +1276,7 @@ static int jffs2_sum_process_sum_data(struct part_info *part, uint32_t offset, &spi->version); b->ino = sum_get_unaligned32( &spi->inode); + b->datacrc = CRC_UNKNOWN; } sp += JFFS2_SUMMARY_INODE_SIZE; @@ -1297,6 +1298,7 @@ static int jffs2_sum_process_sum_data(struct part_info *part, uint32_t offset, &spd->version); b->pino = sum_get_unaligned32( &spd->pino); + b->datacrc = CRC_UNKNOWN; } sp += JFFS2_SUMMARY_DIRENT_SIZE(