Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp647440pxb; Tue, 5 Apr 2022 17:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvemENbog/fZgu3qy13y8Vs9OufVRnjirCzS34YlTH+xc/cjcgIrNFunMPO519+OYBqs3b X-Received: by 2002:a17:90a:5298:b0:1ca:7fb3:145 with SMTP id w24-20020a17090a529800b001ca7fb30145mr6937006pjh.200.1649203954166; Tue, 05 Apr 2022 17:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649203954; cv=none; d=google.com; s=arc-20160816; b=JMapx7qE3fwLl3Kbu0vTpiI9DlKBeARgRLhBKdxXwI9ItnFdZ/UChHHt9VSFmPW3Na L6UMOvs6TleLEwDslP0In+gpxoZ6UKEEgtR7BOpDIObdfOy02I1zWH9jID+c9VE/gzsY MFWNwy34OktWaxDjiej/ssQB+DAFlkKLPtSlyo6RsL5gRZQfRqHwjlMtPbEf9Zy9de+D 04dkACjJF4FyJjpC4ZBLEuRFF28gXbhA9QhfnlPMCzZI1fuNHH/iFeENK/nTEVV8gkpH BKGC/kXCGxwB2PPuxhxjIXlLg1hubq0d+gTEn4hu0FMJzIJA8T1G3tLxffOzfDH0Knfw e+zQ== 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=29pWQNY4svTHj7ceH3nmff4SK/loybCdZi2kVn2Q/wo=; b=J5bkyjWoi/zwhw/XshzPFBEXN/Hi13xw7N2cKMQfwvoQJWjWOhMg70sA2Q5dZG9dyd Ytf2oY8pR6raNE+e7If26XP8153eXLayYs/ty6EWZ4KOQ74PI4qki2/TV+Sy8v+D7if9 Z7j3+JBMWBwcW93uSDAYf/mzMsrXx8ewLMx4Utus6xCwn8G2HzJY1El3OTi2FrFdlN00 UwwJuwrYG+4bmMj4cR7LteyKRBu80/A8cYGvki0KyNk4a6XvutYnx7sGnB2dbb9eAV31 Q0aeqF5g80imqbvp78R8d9PHfAkXMsQ8QPUlWi22SwNS6/d4V0LoWXkiyfhUCIxIf6Bh nCww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=udOgYc9h; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j3-20020a170903028300b00153b2d16639si15687723plr.577.2022.04.05.17.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 17:12:34 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=udOgYc9h; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E31AC15B99A; Tue, 5 Apr 2022 16:56:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237046AbiDENub (ORCPT + 99 others); Tue, 5 Apr 2022 09:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347295AbiDEJZ0 (ORCPT ); Tue, 5 Apr 2022 05:25:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDEADCE19; Tue, 5 Apr 2022 02:15:06 -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 7A17CB81B62; Tue, 5 Apr 2022 09:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3A8AC385A0; Tue, 5 Apr 2022 09:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150105; bh=ygdB+f4jc8V5lXa0aBUeD4eVSbWu2DTS5kWk/ulLU/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udOgYc9hJf2gPO5i8sUspn7SagMC6l9rTUXO+0NStB2HwkIrJgC1cjOcvtFcBxwFp A9hG12eOYTLoGpgh1x1+H7eilwBSdmc21YaZXjEndbeLGxmsbaWtoyIv65+Wmmjvk1 6h3umVLJHkUjJRI4LA5M0Xa2FKh3xasv4byGqyKE= 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 5.16 0955/1017] ACPI: CPPC: Avoid out of bounds access when parsing _CPC data Date: Tue, 5 Apr 2022 09:31:08 +0200 Message-Id: <20220405070422.557094319@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 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 @@ -690,6 +690,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);