Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp139983rdh; Sat, 23 Sep 2023 05:02:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExvh6uQAbPvXpiOYmSlZJASJ5LNBl/AbctyFqVASCwAkL/dkywBDehA4VhLF56CdVFH8Uv X-Received: by 2002:a17:90a:bf12:b0:268:1be1:745a with SMTP id c18-20020a17090abf1200b002681be1745amr1463702pjs.29.1695470574581; Sat, 23 Sep 2023 05:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695470574; cv=none; d=google.com; s=arc-20160816; b=PkYvpq4KPYM1W4/S6CRQtX7+jNbMbMZVMMoLckafTADpNwctvHUuPRA3tJCEo5Me/8 L++ndBsWzc33S+im/cYbkwDBfKaOwzgBfXdW1xIfHalyO21put5fEJJpyjOB1oaKouNl IdX6TV13SxuKo7HC2ugcoo3PC0oJgT+FOJDBjyOvjm/ah+CKij0meXGojudzqXNrdKkx usnl9aGKPAsNqJGhxAA9MO40kr90kgq2G12xG1eBRED4WeA6AQve14obEeOELCzO0+Yl oj65EkB+XedoQV5hFvYxxcFzIckmkIcCQT1+fE/5aZwcL0mJ92UCePD+4BzFsCxRV6YE kQnQ== 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=bZSxBF10b7JzIBFF8G5vrsy/s9cjV1CpGPzr2DXNhYE=; fh=DZTEBuCdFfe2DSdaI+6ceTR59ce872SNjmboNXW/0pA=; b=FS8r98wJ3Mfj8YTGX3fsV5xYSsCVRMuNNtiTO0DuITZkVb5DoGNXgFKyd9E7EGUZI9 OTvTRvu63ubbw/qcfnicgWKupSSTfevpGRMbNTKlB/zs3tzX3I5MPbr13KdnzLE+g7Y3 HtGX1r3UXXqLwK40BiiEp7WqacZ6ck8dc/R2bJk93z6tOBJLBwOUITfzLpjuoWzJ9x97 8Dzd5CyQT+06+UvYYxVhnnsqsE3etPh57YIDglKkgBU8eo0v3eoF5AjRsHkqh08tuBXB xt0mqasrtGH/HeqfzQI6MnFCQmQUy3HYcxZI8vI49V2SH8rQZX5Alc4kk7QWORN+t/nz qEKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lMqjeJM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h23-20020a17090aa89700b00274cf8042b6si4635868pjq.102.2023.09.23.05.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 05:02:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lMqjeJM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 657A682B0FC9; Fri, 22 Sep 2023 16:30:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbjIVXak (ORCPT + 99 others); Fri, 22 Sep 2023 19:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbjIVXaW (ORCPT ); Fri, 22 Sep 2023 19:30:22 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1DE31A1; Fri, 22 Sep 2023 16:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695425416; x=1726961416; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WrOU0a7wgE3OYiSb3Tr3bbEuX5YDrEhEBdcjQkN5ci8=; b=lMqjeJM3mmZJtxPb7TTghy/n6DRieHWdTT/Dmr+ufAhIiGbhHt83rLGC UH9TsQNJF50YhwZshGiN2DgWrGBggS7RqCukxK6KyK3S7dwID5NPMv4Xk GbME4tBcZnS/cAW806wTyTyPFPxcGyzts0Px/fCW7Hf9K2YGCJOkzzafZ mbQ6V5N+LvJyU2lN1zmETi19JQcRRKLrBvuVVj2tvWgYQSbzvQjQxIjDh gclzbxTpISd83gw2hgO263m9RDHZBr/c5HYkJfgNIBaJ83FYhlQktXMf/ 8SBDm2LcYX1JDpTPm7sEx+PsOZeHds+SRSGw2uUeBTif+/1VYjGFY3tWz A==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="411896967" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="411896967" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 16:30:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="921350843" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="921350843" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 16:30:13 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v2 6/9] platform/x86/intel/ifs: Metadata validation for start_chunk Date: Fri, 22 Sep 2023 16:26:03 -0700 Message-Id: <20230922232606.1928026-7-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230922232606.1928026-1-jithu.joseph@intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230922232606.1928026-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 16:30:52 -0700 (PDT) X-Spam-Level: ** 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 b09106034fac..c92d313b921f 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -291,6 +291,13 @@ static int validate_ifs_metadata(struct device *dev) return ret; } + if (ifs_meta->chunks_per_stride != 0 && + (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