diff options
author | Armin Wolf <W_Armin@gmx.de> | 2024-05-23 00:36:48 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-07-27 11:40:17 +0300 |
commit | fd57dbffd92547bd65aadce912e7d4d29438a2f9 (patch) | |
tree | 6fb6b8b738c93b7a935d53dd1a3db26f961a9cba | |
parent | cd9472c43f5e2a96141c2964df6936ceca64dfe3 (diff) | |
download | linux-fd57dbffd92547bd65aadce912e7d4d29438a2f9.tar.xz |
ACPI: EC: Abort address space access upon error
[ Upstream commit f6f172dc6a6d7775b2df6adfd1350700e9a847ec ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/acpi/ec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 487884420fb0..60f49ee16147 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1316,10 +1316,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); |