diff options
-rw-r--r-- | drivers/acpi/apei/einj.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 0431883653be..559c1173de1c 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c | |||
@@ -519,7 +519,7 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, | |||
519 | u64 param3, u64 param4) | 519 | u64 param3, u64 param4) |
520 | { | 520 | { |
521 | int rc; | 521 | int rc; |
522 | unsigned long pfn; | 522 | u64 base_addr, size; |
523 | 523 | ||
524 | /* If user manually set "flags", make sure it is legal */ | 524 | /* If user manually set "flags", make sure it is legal */ |
525 | if (flags && (flags & | 525 | if (flags && (flags & |
@@ -545,10 +545,17 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, | |||
545 | /* | 545 | /* |
546 | * Disallow crazy address masks that give BIOS leeway to pick | 546 | * Disallow crazy address masks that give BIOS leeway to pick |
547 | * injection address almost anywhere. Insist on page or | 547 | * injection address almost anywhere. Insist on page or |
548 | * better granularity and that target address is normal RAM. | 548 | * better granularity and that target address is normal RAM or |
549 | * NVDIMM. | ||
549 | */ | 550 | */ |
550 | pfn = PFN_DOWN(param1 & param2); | 551 | base_addr = param1 & param2; |
551 | if (!page_is_ram(pfn) || ((param2 & PAGE_MASK) != PAGE_MASK)) | 552 | size = ~param2 + 1; |
553 | |||
554 | if (((param2 & PAGE_MASK) != PAGE_MASK) || | ||
555 | ((region_intersects(base_addr, size, IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) | ||
556 | != REGION_INTERSECTS) && | ||
557 | (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_PERSISTENT_MEMORY) | ||
558 | != REGION_INTERSECTS))) | ||
552 | return -EINVAL; | 559 | return -EINVAL; |
553 | 560 | ||
554 | inject: | 561 | inject: |