[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240522213649.2860-1-W_Armin@gmx.de>
Date: Wed, 22 May 2024 23:36:48 +0200
From: Armin Wolf <W_Armin@....de>
To: rafael@...nel.org,
lenb@...nel.org
Cc: linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] ACPI: EC: Abort address space access upon error
Then a multi-byte address space access is requested, acpi_ec_read()/
acpi_ec_write() is being called multiple times.
Abort such operations if a single call to acpi_ec_read()/
acpi_ec_write() fails, as the data read from/written to the EC
might be incomplete.
Signed-off-by: Armin Wolf <W_Armin@....de>
---
drivers/acpi/ec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index e7793ee9e649..a68dce2147a4 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1333,10 +1333,13 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
if (ec->busy_polling || bits > 8)
acpi_ec_burst_enable(ec);
- for (i = 0; i < bytes; ++i, ++address, ++value)
+ for (i = 0; i < bytes; ++i, ++address, ++value) {
result = (function == ACPI_READ) ?
acpi_ec_read(ec, address, value) :
acpi_ec_write(ec, address, *value);
+ if (result < 0)
+ break;
+ }
if (ec->busy_polling || bits > 8)
acpi_ec_burst_disable(ec);
--
2.39.2
Powered by blists - more mailing lists