summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-05-28 04:41:32 +0300
committerArd Biesheuvel <ardb@kernel.org>2022-05-28 12:39:31 +0300
commit630f972d76d6460235e84e1aa034ee06f9c8c3a9 (patch)
tree0740cd597fd3cf9325fdaffe1452f055c04688a3 /arch/riscv
parent3f68e69520d3d52d66a6ad872a75b7d8f2ea7665 (diff)
downloadlinux-630f972d76d6460235e84e1aa034ee06f9c8c3a9.tar.xz
riscv: read-only pages should not be writable
If EFI pages are marked as read-only, we should remove the _PAGE_WRITE flag. The current code overwrites an unused value. Fixes: b91540d52a08b ("RISC-V: Add EFI runtime services") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Link: https://lore.kernel.org/r/20220528014132.91052-1-heinrich.schuchardt@canonical.com Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/kernel/efi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kernel/efi.c b/arch/riscv/kernel/efi.c
index 024159298231..1aa540350abd 100644
--- a/arch/riscv/kernel/efi.c
+++ b/arch/riscv/kernel/efi.c
@@ -65,7 +65,7 @@ static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
if (md->attribute & EFI_MEMORY_RO) {
val = pte_val(pte) & ~_PAGE_WRITE;
- val = pte_val(pte) | _PAGE_READ;
+ val |= _PAGE_READ;
pte = __pte(val);
}
if (md->attribute & EFI_MEMORY_XP) {