summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2024-05-23 00:36:48 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-05-27 13:43:29 +0300
commitf6f172dc6a6d7775b2df6adfd1350700e9a847ec (patch)
tree0ee152587a5c63e9631908a238e08e4f44137dfa /drivers/acpi
parent9b0abe7948364bd35fff2b202ee7f30a2fa73c53 (diff)
downloadlinux-f6f172dc6a6d7775b2df6adfd1350700e9a847ec.tar.xz
ACPI: EC: Abort address space access upon error
When 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@gmx.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ec.c5
1 files changed, 4 insertions, 1 deletions
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);