From patchwork Tue Apr 13 16:37:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1465894 X-Patchwork-Delegate: miquel.raynal@bootlin.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=mSYX5vb4; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=K7L7OZPr; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fpk7iLxh; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4FKWgJ0FVlz9sRR for ; Wed, 14 Apr 2021 02:45:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=QyidqCzwA4EIopstr9FOoxsUa/1f0V/KBlaVxGLcCvI=; b=mSYX5vb47gLpl/HAX2MeMsa2lm EqZ2ygSDVjv8uOg4z6G6KcFsnO54yTlVlzKHBxz2nHcHL2iggpl4Uo5oc0N2q4UQz1WaMdW/H1zZg Iz0PBUgyIp2kkskc11Pd2kShGSVGCKokGH81zmr2H8TkeTbmM7RO3mB+uyYbDaJd5iqm9QpiBjzhs U/l5zx9FL+oBUyP7fJXVlDUNsKOHbWG3zezvI2JSb/xP1swpyGD4WvE69PAHaAWG9HX2lgmbfhfD5 MLYC6o2oGEdax28YbxmnK1nYhUNpu39LbbbNyeDaM+xwOcQATuYM0mscBL0YqP9dl5kTJhpOH28DE whpKcBjA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWM97-009qNg-BH; Tue, 13 Apr 2021 16:44:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWM2U-009pBl-2q for linux-mtd@desiato.infradead.org; Tue, 13 Apr 2021 16:37:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=7iiRIC7UUWnTaGZjjzvtx5ZNWIoZkouacPtJP/jAlsY=; b=K7L7OZPrFLvhGD4zOza3ADkrUV /pCfbLTyWqyr0A4RNdlJTRJTClkTuOx5qL1H9IbdZHPrCTAaUx42g+A4xAEQZpj+siNP5x0y9H37u bGbb45RhW0O6vzqHx/S85JPSfm1jpH7kjNu1FfjNu9Q0Tz32fhLXB/ODvMKqJNnSX9gNx+kwv7kl8 kjGQV47878zKG42/01ZCEHkLqC0EljfH4k/EZGfy0TyVQ16GTKgfDH6Ja5KSHA0pmPzcZuyj3Xmjx Jx0EfCBlVDP72GOhEjex+n/a7wOCI5fi3kkxEv6rEZ24am/wiNhWPjhXCjhS9DnBGypOrDepsGkQm tN6h/xAw==; Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWM2R-007Baf-4M for linux-mtd@lists.infradead.org; Tue, 13 Apr 2021 16:37:20 +0000 Received: by mail-lf1-x129.google.com with SMTP id w8so19866595lfr.0 for ; Tue, 13 Apr 2021 09:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7iiRIC7UUWnTaGZjjzvtx5ZNWIoZkouacPtJP/jAlsY=; b=fpk7iLxhmf9FiKL20+6mGPvLuTjNVFR5sBIAU5QmTdTpS/TeeUR017+2MkdQozT0wd yS9QjYBgnLxZtWucGc63iPib0O270FPfW8sDoLekGa+fFVLJaNQ4fhqlPuvh3qh3Zp3U 8NlTtMUnd71tmLSKv8/pLCi9udn4RLXjPYKe+8fKXZCuEdJyKKZj3+VWpxEo/wp4FpG0 XWh4n5LXsbejcRpblRg63IrTUSOlE+tcwvWD0ZPE2b+YkPsN7Qgj9HbRF6gtFjc0ISnp MwLJlgf60RXRfAHZmnZsU1CsS/MeZK0cDP+3ppHLkkv2eBJIEZzQSOGf3vKcN6O5oj0s +z/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7iiRIC7UUWnTaGZjjzvtx5ZNWIoZkouacPtJP/jAlsY=; b=ZTUnKDVijQwbPeec67dPqrCBa/cfwPjPCHtrixwno9qSKE4HX04HDCzXVWj8EpgdxJ EzEM7s8znU99LOU1e6n0YTc8zZib1UU28pirtENfGydiLuyuGvMMwV6Yy3FuXD0o+uIh JRZsfJo0sUq69iJd33P70IjTMLdr2be4hicbE2vR5AWsbUj5tW6gisl+N6tcMDN2ZkLb O7LREw8HkfnbJQ3pZWU25QVJTGi85kK4Us2DZ5nrf7OhLEGwygaXwfAHz6lVzWMWNWb5 fz7x8dPPexPxCldn9oyywFDvpOSFrg3J2mBIfFJU6xeiBELzV2ZLgOzAaq8W9Xl5jyKl FCyA== X-Gm-Message-State: AOAM530ww2KRl+HBko9HeWKQ/s44SIjS1r3BwJyAufsNcGp2X7JgZGtT vrmA5GJL9Unycp2ki0J0Ndw= X-Google-Smtp-Source: ABdhPJyOtfQ5faeASKaofvaoLEae3KOL7usNOY88wAEoD7yAsyiAcEzx4I1YPnSdxtE3PXloMs7cwQ== X-Received: by 2002:ac2:4e95:: with SMTP id o21mr1594161lfr.325.1618331835433; Tue, 13 Apr 2021 09:37:15 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id z21sm4026777ljh.104.2021.04.13.09.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 09:37:14 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: Vivek Unune , linux-mtd@lists.infradead.org, Rob Herring , devicetree@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH] mtd: parsers: trx: parse "firmware" MTD partitions only Date: Tue, 13 Apr 2021 18:37:00 +0200 Message-Id: <20210413163700.12215-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210413_093719_193614_547F1180 X-CRM114-Status: GOOD ( 13.45 ) X-Spam-Score: 0.1 (/) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__From=3A_Rafa=C5=82_Mi=C5=82ecki_Parsin?= =?unknown-8bit?q?g_every_partition_with_=22compatible=22?= =?unknown-8bit?q?_set_to_=22brcm=2Ctrx=22_results_in_parsing_both=3A_firmwar?= =?unknown-8bit?q?e_partition_and_failsafe?= =?unknown-8bit?q?_partition_on_devices_that_implement_failsafe_booting=2E_Th?= =?unknown-8bit?q?is_affects_e=2Eg=2E_Linksys?= =?unknown-8bit?b?IEVBOSBbLi4uXSA=?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=280=2E1_points=2C_5=2E0_req?= =?unknown-8bit?q?uired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C?= =?unknown-8bit?q?_no_trust?= =?unknown-8bit?b?IFsyYTAwOjE0NTA6NDg2NDoyMDowOjA6MDoxMjkgbGlzdGVkIGluXQ==?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_an_SPF_Record?= =?unknown-8bit?q?_0=2E2_FREEMAIL=5FENVFROM=5FEND=5FDIGIT_Envelope-from_freem?= =?unknown-8bit?q?ail_username_ends?= =?unknown-8bit?q?_in_digit?= =?unknown-8bit?q?_=5Bzajec5=5Bat=5Dgmail=2Ecom=5D?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_0=2E0_FREEMAIL=5FFROM__________Sender_email_is_commonly_ab?= =?unknown-8bit?q?used_enduser_mail?= =?unknown-8bit?q?_provider?= =?unknown-8bit?q?_=5Bzajec5=5Bat=5Dgmail=2Ecom=5D?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_v?= =?unknown-8bit?q?alid_DKIM_or_DK_signature?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FAU__________Message_has_a_valid_DKIM?= =?unknown-8bit?q?_or_DK_signature_from?= =?unknown-8bit?q?_author=27s_domain?= =?unknown-8bit?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_si?= =?unknown-8bit?q?gnature=2C_not_necessarily?= =?unknown-8bit?q?_valid?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FEF__________Message_has_a_valid_DKIM?= =?unknown-8bit?q?_or_DK_signature_from?= =?unknown-8bit?q?_envelope-from_domain?= X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki Parsing every partition with "compatible" set to "brcm,trx" results in parsing both: firmware partition and failsafe partition on devices that implement failsafe booting. This affects e.g. Linksys EA9500 which has: partition@200000 { reg = <0x0200000 0x01d00000>; compatible = "linksys,ns-firmware", "brcm,trx"; }; partition@1f00000 { reg = <0x01f00000 0x01d00000>; compatible = "linksys,ns-firmware", "brcm,trx"; }; Check for MTD partition name "firmware" before parsing. Recently added ofpart_linksys_ns.c creates "firmware" and "failsafe" depending on bootloader setup. Signed-off-by: Rafał Miłecki --- Vivek has recently reported this problem to me and this is soltuion I came up with. One alternative I thought of could be marking "failsafe" MTD partition node as disabled (using of_update_property() + "status" + "disabled") and then using of_device_is_available() in the parser_trx.c. Let me know if you prefer the other (or any other) solution over this patch. --- drivers/mtd/parsers/parser_trx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/parsers/parser_trx.c b/drivers/mtd/parsers/parser_trx.c index 8541182134d4..0063791e164d 100644 --- a/drivers/mtd/parsers/parser_trx.c +++ b/drivers/mtd/parsers/parser_trx.c @@ -58,6 +58,10 @@ static int parser_trx_parse(struct mtd_info *mtd, uint8_t curr_part = 0, i = 0; int err; + /* Don't parse any failsafe / backup partitions */ + if (strcmp(mtd->name, "firmware")) + return -EINVAL; + parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition), GFP_KERNEL); if (!parts)