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 F247B53365; Thu, 12 Dec 2024 17:15:31 +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=1734023732; cv=none; b=M/XwsWjzy/45c1lcGGZVuFNnN8lKWAh0gh1y7HKxqQWKpc7y20mL/A9sKtG+lWbK4qAw6sLkkFXlrsATPIMEczETNAN2PVwFqqItFL1AwV+ucBZn9W42rAE2Z85S3REOAESombweqSpqb4CQlBGYEsT5gfF54I7LMLL1Ol937aE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734023732; c=relaxed/simple; bh=Ehfxkuvl7TYgrSU3WQV9cnkXhiAfWobetZrnY/zz//M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dJxGTSUm6E/8VCF2LVvHWO12/UaDdq8yszqmCuoZoTE7BVc+YddOX/09qBJezuoGhDo4KqDU+k/vFdBDwHoSdNvpijciT04xm079BJFSXsEPg+HrsU5Lj7+N6t3g5fLCqSda2or/XWZQsTgfMVF2cUGMEX7bbbs8X0KQRwpEJuw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nCzZI8Lo; 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="nCzZI8Lo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27943C4CECE; Thu, 12 Dec 2024 17:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734023731; bh=Ehfxkuvl7TYgrSU3WQV9cnkXhiAfWobetZrnY/zz//M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCzZI8Loq9TXZqZQchi86vDfRykSaV714OeuK5vLK+6ip4dtrvUInUpxVbdZEOhq3 7OGxat+NNWl7ZGRFvj+5x62SsBOc/8sv9FJH3UISOZteGvQ9jYARixNYQmyLKtAHWF EpaD2j9U55deD8OvPzjZvJAxu6Oma/NGPTqY7e0I= 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 5.10 064/459] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() Date: Thu, 12 Dec 2024 15:56:42 +0100 Message-ID: <20241212144256.048345341@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144253.511169641@linuxfoundation.org> References: <20241212144253.511169641@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 5.10-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