From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA774149C51; Fri, 6 Dec 2024 14:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733496650; cv=none; b=Vi9Hch994FWohvlXZCm9k5OvgqDX/pG+RUqAQcHWBVoLo/gdQY/oRw7W5GNed126Q12uciPGjW85Ggk4reCNhXowaoKy1su992yUTcQ7vvDkYimVUNOcy/GTmNW367CS5twnijjri5ZPJh7ERykmuMd7Q18Cf+6iu6xVPN/TIUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733496650; c=relaxed/simple; bh=AV/uQeDGbboPFS2XazgKncb5E7YeUfKBvZzxwxOtkWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=twvKjPXd1atDnXKZThb7TcnsF7yOnYu4zcCfefRezJUvx5V9Si4Cx1QwdP0VZQQdoEG2GzpccytU0soNHOVM3E4cSPt0IV8bbZA6s6cZBdPRSPejrytGHt7bFiFgsIupD/fwZMK57XvfpsKI/RAWa8BQM0qfR7hczB65HqxRda0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H4nu4M8U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="H4nu4M8U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18A1EC4CED1; Fri, 6 Dec 2024 14:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733496650; bh=AV/uQeDGbboPFS2XazgKncb5E7YeUfKBvZzxwxOtkWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H4nu4M8Ukc9TlyD/58aZI0pt+Uu5kg5Yosv86O1X5BTu9Ez9kSRi9qIpaovXIShOX mopoyaC4gM+xIT1nG+SotZTfvDliqjPUy5NvZ6fd2PRWr9ihtVjct9LYxonvQbeDIp Ink60vwMLBu+ttYNFWeEUJ12hV4TheuiXXywp7a4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aleksandr Mishin , Hanjun Guo , Sudeep Holla , Catalin Marinas , Sasha Levin Subject: [PATCH 6.6 065/676] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() Date: Fri, 6 Dec 2024 15:28:04 +0100 Message-ID: <20241206143655.899124496@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aleksandr Mishin [ Upstream commit 1a9de2f6fda69d5f105dd8af776856a66abdaa64 ] In case of error in gtdt_parse_timer_block() invalid 'gtdt_frame' will be used in 'do {} while (i-- >= 0 && gtdt_frame--);' statement block because do{} block will be executed even if 'i == 0'. Adjust error handling procedure by replacing 'i-- >= 0' with 'i-- > 0'. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: a712c3ed9b8a ("acpi/arm64: Add memory-mapped timer support in GTDT driver") Signed-off-by: Aleksandr Mishin Acked-by: Hanjun Guo Acked-by: Sudeep Holla Acked-by: Aleksandr Mishin Link: https://lore.kernel.org/r/20240827101239.22020-1-amishin@t-argos.ru Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- drivers/acpi/arm64/gtdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c index c0e77c1c8e09d..eb6c2d3603874 100644 --- a/drivers/acpi/arm64/gtdt.c +++ b/drivers/acpi/arm64/gtdt.c @@ -283,7 +283,7 @@ static int __init gtdt_parse_timer_block(struct acpi_gtdt_timer_block *block, if (frame->virt_irq > 0) acpi_unregister_gsi(gtdt_frame->virtual_timer_interrupt); frame->virt_irq = 0; - } while (i-- >= 0 && gtdt_frame--); + } while (i-- > 0 && gtdt_frame--); return -EINVAL; } -- 2.43.0