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 8FA2F235C5F; Thu, 12 Dec 2024 16:45:05 +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=1734021905; cv=none; b=IlmSKd2Rh+Y1nVQmt0FDv+JdOrsraq97AJ52N5I1/FEFz6a0h83Tx7JJHbZLqW8eRByXuTnP9bJUJUIdzTCJp9aVLh7MxF2KZ1prWKakN1NU6/oXoca6OXHBsm4+Wf9+e0+5lGSeIXEDQnSs0pk/k3W6m+5dJ0B174u+VNp4Vf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734021905; c=relaxed/simple; bh=Zpvbx7t/XI1UWIjaOgWGzLWQ0Bi6pkgF8t9CRxmPFbs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cc3posXuNEsNOGIf4sdJfdSAQmeFsig9oyEhK2lMe1SCC5lLccouwq32VANHYYDMKWTXT0COlZx9oN6bfEr0kv7cNudtPmKr/gNdxDm+/XQ29RdYDGIHhzclB1/LLhlfMm10R9v6vQjMmg5CXPHXetlz+ep6J26L5gLlJnyu+DQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oc0BsoTn; 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="oc0BsoTn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E69C5C4CECE; Thu, 12 Dec 2024 16:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734021905; bh=Zpvbx7t/XI1UWIjaOgWGzLWQ0Bi6pkgF8t9CRxmPFbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oc0BsoTnpG1+YEOrvQPuc2r/2UF2QTaCSDIHvFJQprGUpbLzXAsPcyKc2mEO47YDd DWGUvk4sKSj4kbGaqzpJcWw9WafHfO7Ldcn9pZT6OV+fV+IHuMRKNA7D0KGKHXgJVc Rd0iWcHEKtYtQ+L7DsMVybuxIZ0SQZxGtQelipNA= 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.15 088/565] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() Date: Thu, 12 Dec 2024 15:54:43 +0100 Message-ID: <20241212144314.965622245@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144311.432886635@linuxfoundation.org> References: <20241212144311.432886635@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.15-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