Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3618217rdb; Wed, 13 Sep 2023 18:54:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyMkKnoJOinE1SCx0gyIQbs7J440p5wNqSgEJMmBpq2TxMDBtlTv+CQqbUDUzkZsIq+m6p X-Received: by 2002:a05:620a:228f:b0:76f:2786:e688 with SMTP id o15-20020a05620a228f00b0076f2786e688mr3457375qkh.72.1694656489352; Wed, 13 Sep 2023 18:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694656489; cv=none; d=google.com; s=arc-20160816; b=XcAEYr/a9YZwrxy9u0XHMoMRITobWgUwFWbromCilsHRZYuycfRown3hwrkihT7916 navcqKUjSQ8R6MujWyjhtCiRBEjFSE/PyBcXwWZOsx/z3RzAcHvDFZ9hb1LJEczOPtS6 /ZMjANI5ZYtNXf09zS7HIXKG1bC/yemKyW1TEZVWfIoLoyNF4/iehxc+nsHXDn3n4ETC 2iUW4E2Xgq21ckFoDruOIT8VYC899NRekCGZBd3PTSeICP5BDBVKffluBE2Q6OUASUIw Twl0oKrdGKN9tv0DMInEMs1zEcXprOyynyX2dOdPD1BX9IACXsw2soRSRbsjO3zlVXc0 32rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NZFJ4o5mm7FUH+JVrXnTP4TPi/EPJAj11O68yJJRzQo=; fh=8xS9zNNEexx7KHEczBpq5wXIDtxA/g5mXnxETx6X+p0=; b=yOqU3SabzZv6UUVz/tNAMUZb0QXo3b3/iiY/V7Aw01iITC9dV/BeADrQpSxJ4nduIu s+pRhg/tWzfAUrWuUTf514jvT68gMZIeOMvYlYSZwITeIyE598P2plmwlNO7oQLvKcdI RdcOs1TPYbsshSP67YOipA3QjFjEkz6/5jhCOgNeIHRyXZRRPxWluyd0QYIueZvuI7Mu 1+VbdvIZ9Xp6EHz5VhO1Lvvt7hi2Ww8Yr4WWZHtKVwTSn9nwXrZsvz5/7hw5pa53lugw OHeu4nQlM6K/H7XbjH3A0RyFvNKxktgplaFroeue+8qz5RJN25dE3DwRhRcoZzFBU3Xh TB5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DWixgxhi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ay26-20020a056a00301a00b0068a55cc9a10si514450pfb.381.2023.09.13.18.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 18:54:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DWixgxhi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0BB81834FBB4; Wed, 13 Sep 2023 11:38:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjIMSiV (ORCPT + 99 others); Wed, 13 Sep 2023 14:38:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231918AbjIMSiB (ORCPT ); Wed, 13 Sep 2023 14:38:01 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C58BA3; Wed, 13 Sep 2023 11:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694630277; x=1726166277; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=27uuSgwznKYWiVr2rzZGk8zPvF6mY8zY3sne3jlCPzw=; b=DWixgxhi9Wc+QQu863a2xfIfb363nxibe+8INkzu0gFUZFgQ70wDmh3X Pl8vH6ho2uuh5E6YIyBHYtxZBAnzIWv2uiaBCwm8Iuy0IABqvg0Y8NAD0 MjbCqk1Axs859rylCYxs56pPDGUpH97X9at0VZ6m23yQz15IKx0AmGwPB amOk7X4x+Eo4XEcLT7ORH0flqiuy5McpGsdtST+/VBEXc/+Q79zqL0elg T98mZitDM8wvJbgrHUq57DkDSltjXpcThkHTRhINQCadQx/w/bDtVPrZ4 V7+jMi2s6ePiWy6/WjSXH6TTppKsh68ZgUuzzyjC0nedulJGGAPyI9NQn g==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="369019182" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="369019182" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 11:37:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="744238595" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="744238595" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 11:37:56 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rostedt@goodmis.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, pengfei.xu@intel.com Subject: [PATCH 07/10] platform/x86/intel/ifs: Metadata validation for start_chunk Date: Wed, 13 Sep 2023 11:33:45 -0700 Message-Id: <20230913183348.1349409-8-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230913183348.1349409-1-jithu.joseph@intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Sep 2023 11:38:33 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Add an additional check to validate IFS image metadata field prior to loading the test image. If start_chunk is not a multiple of chunks_per_stride error out. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Tested-by: Pengfei Xu --- drivers/platform/x86/intel/ifs/load.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 778a3b89a24d..88630366a23c 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -292,6 +292,13 @@ static int validate_ifs_metadata(struct device *dev) return ret; } + if (ifs_meta->chunks_per_stride && + (ifs_meta->starting_chunk % ifs_meta->chunks_per_stride)) { + dev_warn(dev, "Starting chunk num %d not a multiple of chunks_per_stride %d\n", + ifs_meta->starting_chunk, ifs_meta->chunks_per_stride); + return ret; + } + return 0; } -- 2.25.1