Patch "riscv: Fix wrong usage of lm_alias() when splitting a huge linear mapping" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    riscv: Fix wrong usage of lm_alias() when splitting a huge linear mapping

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     riscv-fix-wrong-usage-of-lm_alias-when-splitting-a-h.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4738f27c183a4dc56ebb9433c140e4d11a59b3c0
Author: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
Date:   Tue Dec 12 20:54:00 2023 +0100

    riscv: Fix wrong usage of lm_alias() when splitting a huge linear mapping
    
    [ Upstream commit c29fc621e1a49949a14c7fa031dd4760087bfb29 ]
    
    lm_alias() can only be used on kernel mappings since it explicitly uses
    __pa_symbol(), so simply fix this by checking where the address belongs
    to before.
    
    Fixes: 311cd2f6e253 ("riscv: Fix set_memory_XX() and set_direct_map_XX() by splitting huge linear mappings")
    Reported-by: syzbot+afb726d49f84c8d95ee1@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://lore.kernel.org/linux-riscv/000000000000620dd0060c02c5e1@xxxxxxxxxx/
    Signed-off-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
    Reviewed-by: Charlie Jenkins <charlie@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231212195400.128457-1-alexghiti@xxxxxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c
index fc5fc4f785c4..96cbda683936 100644
--- a/arch/riscv/mm/pageattr.c
+++ b/arch/riscv/mm/pageattr.c
@@ -305,8 +305,13 @@ static int __set_memory(unsigned long addr, int numpages, pgprot_t set_mask,
 				goto unlock;
 		}
 	} else if (is_kernel_mapping(start) || is_linear_mapping(start)) {
-		lm_start = (unsigned long)lm_alias(start);
-		lm_end = (unsigned long)lm_alias(end);
+		if (is_kernel_mapping(start)) {
+			lm_start = (unsigned long)lm_alias(start);
+			lm_end = (unsigned long)lm_alias(end);
+		} else {
+			lm_start = start;
+			lm_end = end;
+		}
 
 		ret = split_linear_mapping(lm_start, lm_end);
 		if (ret)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux