Commit 44512189 authored by Armin Wolf's avatar Armin Wolf Committed by liwei
Browse files

ACPI: EC: Avoid returning AE_OK on errors in address space handler

stable inclusion
from stable-v4.19.319
commit 286b25bf40251e940756371eae6c7e59fdbd6745
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAMXCL
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=286b25bf40251e940756371eae6c7e59fdbd6745



---------------------------

[ Upstream commit c4bd7f1d78340e63de4d073fd3dbe5391e2996e5 ]

If an error code other than EINVAL, ENODEV or ETIME is returned
by acpi_ec_read() / acpi_ec_write(), then AE_OK is incorrectly
returned by acpi_ec_space_handler().

Fix this by only returning AE_OK on success, and return AE_ERROR
otherwise.

Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
[ rjw: Subject and changelog edits ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarliwei <liwei728@huawei.com>
parent 55398d69
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1345,8 +1345,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
		return AE_NOT_FOUND;
	case -ETIME:
		return AE_TIME;
	default:
	case 0:
		return AE_OK;
	default:
		return AE_ERROR;
	}
}