diff mbox series

ACPI: APEI: EINJ: Limit error type to 32-bit width

Message ID 20230118063504.58026-1-xueshuai@linux.alibaba.com
State Accepted
Commit 53fc7e80f3aa9c34d396bcfbcc03a4c0d2eaac96
Headers show
Series ACPI: APEI: EINJ: Limit error type to 32-bit width | expand

Commit Message

Shuai Xue Jan. 18, 2023, 6:35 a.m. UTC
The bit map of error types to inject is 32-bit width[1]. Add parameter
check to reflect the fact.

[1] ACPI Specification 6.4, Section 18.6.4. Error Types

Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
---
 drivers/acpi/apei/einj.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Rafael J. Wysocki Jan. 30, 2023, 3:41 p.m. UTC | #1
On Thu, Jan 19, 2023 at 3:10 AM Shuai Xue <xueshuai@linux.alibaba.com> wrote:
>
>
>
> On 2023/1/19 AM12:37, Luck, Tony wrote:
> >> The bit map of error types to inject is 32-bit width[1]. Add parameter
> >> check to reflect the fact.
> >>
> >> [1] ACPI Specification 6.4, Section 18.6.4. Error Types
> >>
> >> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
> >
> > Reviewed-by: Tony Luck <tony.luck@intel.com>

Applied as 6.3 material, thanks!
Shuai Xue Jan. 31, 2023, 1:57 a.m. UTC | #2
On 2023/1/30 PM11:41, Rafael J. Wysocki wrote:
> On Thu, Jan 19, 2023 at 3:10 AM Shuai Xue <xueshuai@linux.alibaba.com> wrote:
>>
>>
>>
>> On 2023/1/19 AM12:37, Luck, Tony wrote:
>>>> The bit map of error types to inject is 32-bit width[1]. Add parameter
>>>> check to reflect the fact.
>>>>
>>>> [1] ACPI Specification 6.4, Section 18.6.4. Error Types
>>>>
>>>> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
>>>
>>> Reviewed-by: Tony Luck <tony.luck@intel.com>
> 
> Applied as 6.3 material, thanks!

Thank you.

Cheers
Shuai
diff mbox series

Patch

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index ab86b2f4e719..b4373e575660 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -616,6 +616,10 @@  static int error_type_set(void *data, u64 val)
 	u32 available_error_type = 0;
 	u32 tval, vendor;
 
+	/* Only low 32 bits for error type are valid */
+	if (val & GENMASK_ULL(63, 32))
+		return -EINVAL;
+
 	/*
 	 * Vendor defined types have 0x80000000 bit set, and
 	 * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE