Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2190482pxb; Fri, 25 Mar 2022 12:42:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzafDnVpWJCdBnnuKmpz4xHdz33ekWFpCj7ROkWy0uCUosigIy210Mt+NFtrj1k36CsTJlx X-Received: by 2002:a17:902:930b:b0:14d:b0c0:1f71 with SMTP id bc11-20020a170902930b00b0014db0c01f71mr13469951plb.113.1648237373908; Fri, 25 Mar 2022 12:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648237373; cv=none; d=google.com; s=arc-20160816; b=yzVVJ6ZrghAowZ6tTRtKsFP+uo2zV4ziCPj/eZRKHgO7PmZ2imHy/eeyTGmRWt9dwE 4HQcBbPtxB/XLeT37jZyIucsOthuTePp+53C2Iea96iEErBhe29P4SlBhVP/fJ++RRIZ bI51wLDCgovHCbAviV3SvjTXOZfWOU4nvlpLs8jRSLXGGege4CRXW8XE/xIhph9kQhsv /PNx7vfNwzXRqt+b/Qf9/4WjDAzI2YClH4mZCdF07jKyhh+wNKXkkOk7VQk3a5SIGwoF ohOZRbh9gXXvTYI7fs4TEJD/zOMj24ZFcxN7jivFuql/4rebw6VTBKL6F5iORmdC+Ucj FYXA== 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; bh=UK32gfNu9631SLA2I9kV4yq9le9OGOagUYxHYqMGedY=; b=X595pu/1sAyTJruSmvhXSB327ApLJ+TphDwkwFxfy2Jislp/a84Y1DyJHenU7eJMZA u5N34rxS1q4vQxxZ8HymQjVeJU0mrOXMgCG12wgQFMV8zP4duX7Rtd6ABsWljV0969hl Gisk5r6RNJ1bmtQMY9+2uCIuiWvr6GM2X/Eruiv/Ngs5G+cgR40YviyXN9LmgxrBxFUv o80ekkaf+Do6G3XC26uC2GjgzYiGcQVhBup1HNFIIiN75Nu+4SZP/Ag0sfQm3w0JnCQN 9EADtTW1MczHtVdh5XbBjI4ahIQv9KqFNXP1VURDcSniwXKKj35JZlsEOBX02P6aH4e+ yBTw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r4-20020a170902ea4400b00153b2d16403si3168196plg.11.2022.03.25.12.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 12:42:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84B8A294A32; Fri, 25 Mar 2022 11:33:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238820AbiCVQFb (ORCPT + 99 others); Tue, 22 Mar 2022 12:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236653AbiCVQF3 (ORCPT ); Tue, 22 Mar 2022 12:05:29 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662456F4BD; Tue, 22 Mar 2022 09:04:00 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.0.0) id 8cec46cd286a4186; Tue, 22 Mar 2022 17:03:59 +0100 Received: from kreacher.localnet (unknown [213.134.175.187]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 479F566B920; Tue, 22 Mar 2022 17:03:58 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI Cc: Linux PM , LKML , Srinivas Pandruvada , Mario Limonciello , Ionela Voinescu Subject: [PATCH v1 1/2] ACPI: CPPC: Avoid out of bounds access when parsing _CPC data Date: Tue, 22 Mar 2022 17:02:05 +0100 Message-ID: <4725716.31r3eYUQgx@kreacher> In-Reply-To: <5552457.DvuYhMxLoT@kreacher> References: <5552457.DvuYhMxLoT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.175.187 X-CLIENT-HOSTNAME: 213.134.175.187 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrudeghedgkedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeetgefgleetgeduheeugeeikeevudelueelvdeufeejfeffgeefjedugfetfeehhfenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppedvudefrddufeegrddujeehrddukeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudejhedrudekjedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsrhhinhhivhgr shdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepmhgrrhhiohdrlhhimhhonhgtihgvlhhlohesrghmugdrtghomhdprhgtphhtthhopehiohhnvghlrgdrvhhoihhnvghstghusegrrhhmrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki If the NumEntries field in the _CPC return package is less than 2, do not attempt to access the "Revision" element of that package, because it may not be present then. Fixes: 337aadff8e45 ("ACPI: Introduce CPU performance controls using CPPC") BugLink: https://lore.kernel.org/lkml/20220322143534.GC32582@xsang-OptiPlex-9020/ Reported-by: kernel test robot Signed-off-by: Rafael J. Wysocki --- drivers/acpi/cppc_acpi.c | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-pm/drivers/acpi/cppc_acpi.c =================================================================== --- linux-pm.orig/drivers/acpi/cppc_acpi.c +++ linux-pm/drivers/acpi/cppc_acpi.c @@ -679,6 +679,11 @@ int acpi_cppc_processor_probe(struct acp cpc_obj = &out_obj->package.elements[0]; if (cpc_obj->type == ACPI_TYPE_INTEGER) { num_ent = cpc_obj->integer.value; + if (num_ent <= 1) { + pr_debug("Unexpected _CPC NumEntries value (%d) for CPU:%d\n", + num_ent, pr->id); + goto out_free; + } } else { pr_debug("Unexpected entry type(%d) for NumEntries\n", cpc_obj->type);