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 46BF21F706C; Tue, 3 Dec 2024 14:58:24 +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=1733237904; cv=none; b=pblPoIMlKU2cGhvDfMh/YCZxb4REnQaHe08YYkZDepXgnhbE3N410+AdJ5kk6mZFo4ByIU33/7ZSaY8Unvbdw3KPGxT0V3FDMELeqr7jTDnXxjqObEZRMli3jz2O3QZOU3IpXSU1McblEwSG4/JVWbmk5w0k3pDUpQogk2RL5/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733237904; c=relaxed/simple; bh=hYBjyJfdc6GR+Ko6Bb8+mPTRWoeC5s94IG1jOlJ86Yg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TkIPX1f/zAgvKM0iagKvss5EVyOr1/RKq6bpTALHon5WjBPpGe6vXOjiN0OnZJYUv+/VL68ewNKBtzmHiRXefW30VTQzykaRW0ZhAgfroWxz41h1K4D95i5C+MXtgma+3xdOS4Z/PuE9oeSLc3pri/Gw1tZKf1xH501g29EIoes= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JhfsxVyK; 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="JhfsxVyK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA3C8C4CECF; Tue, 3 Dec 2024 14:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733237904; bh=hYBjyJfdc6GR+Ko6Bb8+mPTRWoeC5s94IG1jOlJ86Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JhfsxVyKoKz8jaUatcDeFwgoaJcvvNkfk6rr9pm6qJOexLS9/1iOeTMOjyB2kdvGg ypi9bb1EP4zH8P/n94RwEm0mXAzVUla4pqlhwnjOqHok7jwfDTcBUHohhydTsVs9RL S0PU4WTmSCo23jq+iODbGsd/b5DlsJ1HCsJvq1IE= 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.11 071/817] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() Date: Tue, 3 Dec 2024 15:34:03 +0100 Message-ID: <20241203143958.459757809@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241203143955.605130076@linuxfoundation.org> References: <20241203143955.605130076@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-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