Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2861536pxb; Mon, 18 Apr 2022 09:46:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV+btlLPzP24PMQU1Su8rqdawGJEYN/U91J5rd5/Mk7Je4y7zvTEGuMQOpBYGKxYQw+Ddb X-Received: by 2002:a17:907:7e97:b0:6e8:9a81:9197 with SMTP id qb23-20020a1709077e9700b006e89a819197mr9673963ejc.634.1650300376905; Mon, 18 Apr 2022 09:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650300376; cv=none; d=google.com; s=arc-20160816; b=HokIhS9L2K6ei3LyuCo34/HTzd5iTuDWVe6vP56IWNIRgq2aI7g4jgZnLo/60L4hmW hGP4bEED7s3IB/WLP1HvZyrn8SGsSJ3qRT5bJ7MYEZauoB9F0GrCNOXldfPzSg3ZVD1r RnYc0riq1Bbov4t7Spu/kfL0ZpgqXN5CyBXucrg4Yhh5GQDhrdOZ/IZbdqY2RF3ay5zu JuGa8yqMO1TvVo4abo0Z9Y25JHGzEWijIpEcACNn4xye+eWtJK6b3fKigva9OyTmZALN +KVvkn+StAAqDRl53dgWrfw+Hhxn8Pxb6dgXubyfn/EidEXoAOON7QSumlE4iFovSbx3 j0HA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IeZAhQ9FJuE4ItQPvLO7pId61bZZW1MbSDSEXtebT20=; b=s8WlBR9QVaib+9dUiW/gsUfsu5ax5kYFC/IwufrhywqW4x9H+0TCo7nMI/ZZ9bfC6E sXi9I/791jwT9HIZw7KKpu0tH0HBVCM5P6EqzAFuWSo2LmtYUTkaEVvU5AVEFzNMnVeD xRKypOj+QzoBbj2JS2Cw+EQC+7RGU8BPlFm0LaUmlMlO9BP0Tmc7ty48fItf6PrBxqxd z7nC8KoZZwtlxYxzgDPTKZo5c4/a1ZnwMWQo2SHYj6iZZJUGyFrzkwEwu+I4jDQHnO2G as2SBVcNYe1sxAJQUduV6xDIbAWfMak433rSq5OC4G2fFbM/y0tXDeOeNjktM4+mrbkB 6hsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EcV0zCs5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a170906601200b006e871dcbafbsi6438739ejj.575.2022.04.18.09.45.52; Mon, 18 Apr 2022 09:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EcV0zCs5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244271AbiDRN4j (ORCPT + 99 others); Mon, 18 Apr 2022 09:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244885AbiDRNbA (ORCPT ); Mon, 18 Apr 2022 09:31:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C3BBB40; Mon, 18 Apr 2022 05:57:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E7295B80D9C; Mon, 18 Apr 2022 12:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5178BC385A1; Mon, 18 Apr 2022 12:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286626; bh=CtgnVmjO7n35BM1i49bLL7QIy1XlXumsaStrof2QA5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcV0zCs5H3Bykpzs6qYLHgW+oT3/Oe34aBiUqY+4lCOhNfXASZ7qHytmdQh78g+zC 6GpUjSYdLPXm1ECy4vPLbat/u+EqF0VPuK1NOfe84wVu0Xv+I/Yt5VRLWWMWtYFX87 TPKxo2UAz6u9ESXtRGUeLEsGoO2gwReJo06uelWY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Rafael J. Wysocki" , Huang Rui Subject: [PATCH 4.14 194/284] ACPI: CPPC: Avoid out of bounds access when parsing _CPC data Date: Mon, 18 Apr 2022 14:12:55 +0200 Message-Id: <20220418121217.247611588@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 commit 40d8abf364bcab23bc715a9221a3c8623956257b upstream. 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 Reviewed-by: Huang Rui Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/cppc_acpi.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -678,6 +678,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);