From patchwork Mon Sep 25 19:06:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuomas Tynkkynen X-Patchwork-Id: 818337 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=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xpgy7G10"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3y1D8z17f7z9s7g for ; Tue, 26 Sep 2017 05:06:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B62AFC21C4C; Mon, 25 Sep 2017 19:06:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C1BCAC21C4C; Mon, 25 Sep 2017 19:06:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AE33BC21C45; Mon, 25 Sep 2017 19:06:47 +0000 (UTC) Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by lists.denx.de (Postfix) with ESMTPS id 4C6DCC21C26 for ; Mon, 25 Sep 2017 19:06:47 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id k20so366297wre.1 for ; Mon, 25 Sep 2017 12:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=4bQZ69wl2PLyez/10/ENzSunfD/4EcRBXYIFUhr99LA=; b=Xpgy7G10zR5WTuypBx6O8z3pHBF1H1Y3c8Z22W8+WmZh2VRcbVTXd7YD7jV/ctOuHi qQwe3lcRtzJu8M4D/llmLOlh7R2GlhMS2qvPcPak5IiTSwSFwDqc/vaHo3YmwojtBjK0 1PGQZ8EzTwoTCu5hSrYpmYzNN2Gg9BvcH22FK6H+ajfuv1TOux92x6ytdNzKVCedFH+b cqgIMuPMmXDvujh71EOXqgR8jWc5V41Vut0/hEfWCAxmZx3HjfRC190jXD4uy1EJ4/co fhcP5oFHt3VZp2bx15SRAs/qZEaNQWfdZyBMX4bhoYWtMYBvs92MGwB/zkj+iNqkmkhF Wa5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=4bQZ69wl2PLyez/10/ENzSunfD/4EcRBXYIFUhr99LA=; b=IgnbgTJ7Zjcgfjl6G3Utvij4smt2kLIEVaIMtgSOlTVuQ+D5KIrIy0SdmejFIqiD4S 1Qzx2pVjp5O0jupe+CaFGAwxQWDGW+IOzdvhf6rHose8zMuPOLUkiCncwf/0tuUr+eXj gvToG2KvlqC6eXmg+ugleXuUMjkM+h9CSkRNj9oHJMBOERM0jwZS/djlUhf4ATcwgSTn uC6naHKYuLItOUvrJ4RohviYRw0b70pr+cyH280ptWNQTx+RAQRtI2cgOz807RcHTDqh ci1d8RDggk3l2REkCCZ4GYhnM9/jmVMHlvyhltVTCaAgMFaUjkRr4La4aVJE8YoSz1QQ F+rg== X-Gm-Message-State: AHPjjUivQZ+jIOohYcwCjvYZVPW0l2rbAE5wRAB4d8lnVuqY9U+i8RYs AwS8oQgjvPmIpo5e+QtrHujt2xx8 X-Google-Smtp-Source: AOwi7QDB0ycxOYK76wwAF8WJU2fsMcufGpoxgYchiQQHrsgEjHYX7DW9RAmiK7+/DToWEUnczJV48Q== X-Received: by 10.46.25.81 with SMTP id p78mr3342763lje.65.1506366406660; Mon, 25 Sep 2017 12:06:46 -0700 (PDT) Received: from duuni.srv.tuxera.com ([194.100.106.190]) by smtp.gmail.com with ESMTPSA id 15sm1564203ljf.22.2017.09.25.12.06.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Sep 2017 12:06:45 -0700 (PDT) From: Tuomas Tynkkynen To: u-boot@lists.denx.de Date: Mon, 25 Sep 2017 22:06:31 +0300 Message-Id: <20170925190634.21738-1-tuomas.tynkkynen@iki.fi> X-Mailer: git-send-email 2.13.0 Cc: Tom Rini Subject: [U-Boot] [PATCH v2 1/4] fs/ext4: Fix group descriptor checksum calculation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The current code doesn't compute the group descriptor checksum correctly for the filesystems that e2fsprogs 1.43.4 creates (they have 'Group descriptor size: 64' as reported by tune2fs). Extend the checksum calculation to be done as ext4_group_desc_csum() does in Linux. This fixes these errors in dmesg from running fs-test.sh and makes it succeed again: [1671902.620699] EXT4-fs (loop1): ext4_check_descriptors: Checksum for group 0 failed (35782!=10965) [1671902.620706] EXT4-fs (loop1): group descriptors corrupted! Signed-off-by: Tuomas Tynkkynen --- v2: New patch --- fs/ext4/ext4_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 621c61e5c7..31952f48b9 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -432,6 +432,10 @@ uint16_t ext4fs_checksum_update(uint32_t i) crc = ext2fs_crc16(crc, desc, offset); offset += sizeof(desc->bg_checksum); /* skip checksum */ assert(offset == sizeof(*desc)); + if (offset < fs->gdsize) { + crc = ext2fs_crc16(crc, (__u8 *)desc + offset, + fs->gdsize - offset); + } } return crc;