Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547719pxb; Mon, 24 Jan 2022 11:57:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJywLBCDOD1J2u7pcYIPiksJp8MfVEWtCAnf5hwTg8PSpbQcIW7E0v43Is0pzJOzjwAdOBHZ X-Received: by 2002:a62:5211:0:b0:4bc:c949:ae8d with SMTP id g17-20020a625211000000b004bcc949ae8dmr15574462pfb.26.1643054259040; Mon, 24 Jan 2022 11:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054259; cv=none; d=google.com; s=arc-20160816; b=dgXT85nOvTLz3RtZHt1kyGeRyCxS1wdey9YNeT299nVXPQuv58CftrMOv2eklZrolC dn8+3glTYmXQWiIrEtx31qp5QYIbMphQqps2Yjqk0Po4s+eUtDi0c1LCF/krtC2AsBzO sUsduYxwOJAhaTW5VdsraIL/UDFEvdyeOa48wQBWhSN5v/V3E5JSyi+2avtweeJrJJtt 6hVPV88rShiMn4GqjdGXiMutZ4Omu6LRUvxMsMcRR/w7AmmcDsNWPYybxUjltCuzTELx qEPBk9HBkDdi6vwP37pnvBNgY2N8wkWrsdBkUBzlS+Ipru5Kfx7NsZm2wxkzYWCK0Bb1 3WwQ== 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=qzytn0g+g7VnGWubGnJye8K+vua6JOSbJ5zA8eqbjDc=; b=hOmyZdD7Yu1qKJ3KQk3qx2mmZ4QQlmQ3Uz5DyL5pBIl8U5dmVTE07S3oM7/SL5JTv8 7hc3vmEDtBjZA3dbYb36DhZe7K2VoPli+w/MUkK5q525a0bZ5GvGThGaYwq3vi1wauUQ /XQJVRtevFHwxzcLMJGiaFvGVwzSKA9XoMXv+wnUjJZDy8D4c6gCLD53sCNdcO6PpUiV kts7v9U5qJoTXiAqDQyZsF2mhZZnGuIrlzN9SmAAvr9NuUYdFfe83DGCDx9tdFZF3x92 tX4FI2BwJ/dWX0RrmdZmd2And1+1LVPDA7LLg7Gl9YCuegcADWVwLB9FyArGf5axB7YU nhXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vmmXMmEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si16440107pfu.101.2022.01.24.11.57.26; Mon, 24 Jan 2022 11:57:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vmmXMmEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1343597AbiAXSxV (ORCPT + 99 others); Mon, 24 Jan 2022 13:53:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:50868 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343770AbiAXSvp (ORCPT ); Mon, 24 Jan 2022 13:51:45 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 26D8A614B8; Mon, 24 Jan 2022 18:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 059E8C340E5; Mon, 24 Jan 2022 18:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050304; bh=8lkdPXw64WnH0LbJLLWSNBVo1R68EaddM02RHx+wedE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vmmXMmEQzZYuN+GteBYUIto+NXFQ6ziRnonCeUGHaSYG4H/xaQo37sk+dZgbrurkM fVi12ptyw2K1mAnwue1paRegFVbHGEULDvq68i5Q9Pjh4WwD+xVkiliWKiR3umHIzh AIg84eDv/GjY9aV9dAccfIjikCJjDxw8xs0IAgh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lenny Szubowicz , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 4.4 075/114] ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() Date: Mon, 24 Jan 2022 19:42:50 +0100 Message-Id: <20220124183929.409926826@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki [ Upstream commit 24ea5f90ec9548044a6209685c5010edd66ffe8f ] ACPICA commit d984f12041392fa4156b52e2f7e5c5e7bc38ad9e If Operand[0] is a reference of the ACPI_REFCLASS_REFOF class, acpi_ex_opcode_1A_0T_1R () calls acpi_ns_get_attached_object () to obtain return_desc which may require additional resolution with the help of acpi_ex_read_data_from_field (). If the latter fails, the reference counter of the original return_desc is decremented which is incorrect, because acpi_ns_get_attached_object () does not increment the reference counter of the object returned by it. This issue may lead to premature deletion of the attached object while it is still attached and a use-after-free and crash in the host OS. For example, this may happen when on evaluation of ref_of() a local region field where there is no registered handler for the given Operation Region. Fix it by making acpi_ex_opcode_1A_0T_1R () return Status right away after a acpi_ex_read_data_from_field () failure. Link: https://github.com/acpica/acpica/commit/d984f120 Link: https://github.com/acpica/acpica/pull/685 Reported-by: Lenny Szubowicz Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpica/exoparg1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 77930683ab7dd..c20b7dfec7b20 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c @@ -1016,7 +1016,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) (walk_state, return_desc, &temp_desc); if (ACPI_FAILURE(status)) { - goto cleanup; + return_ACPI_STATUS + (status); } return_desc = temp_desc; -- 2.34.1