Patch "openrisc: fix SMP tlb flush NULL pointer dereference" has been added to the 5.10-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

    openrisc: fix SMP tlb flush NULL pointer dereference

to the 5.10-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:
     openrisc-fix-smp-tlb-flush-null-pointer-dereference.patch
and it can be found in the queue-5.10 subdirectory.

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



commit d2fea2a7909fa398bf82fcdb598c74ca542a6e2c
Author: Stafford Horne <shorne@xxxxxxxxx>
Date:   Wed Nov 3 20:19:33 2021 +0900

    openrisc: fix SMP tlb flush NULL pointer dereference
    
    [ Upstream commit 27dff9a9c247d4e38d82c2e7234914cfe8499294 ]
    
    Throughout the OpenRISC kernel port VMA is passed as NULL when flushing
    kernel tlb entries.  Somehow this was missed when I was testing
    c28b27416da9 ("openrisc: Implement proper SMP tlb flushing") and now the
    SMP kernel fails to completely boot.
    
    In OpenRISC VMA is used only to determine which cores need to have their
    TLB entries flushed.
    
    This patch updates the logic to flush tlbs on all cores when the VMA is
    passed as NULL.  Also, we update places VMA is passed as NULL to use
    flush_tlb_kernel_range instead.  Now, the only place VMA is passed as
    NULL is in the implementation of flush_tlb_kernel_range.
    
    Fixes: c28b27416da9 ("openrisc: Implement proper SMP tlb flushing")
    Reported-by: Jan Henrik Weinstock <jan.weinstock@xxxxxxxxxxxxxx>
    Signed-off-by: Stafford Horne <shorne@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index 1b16d97e7da7f..a82b2caaa560d 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -33,7 +33,7 @@ page_set_nocache(pte_t *pte, unsigned long addr,
 	 * Flush the page out of the TLB so that the new page flags get
 	 * picked up next time there's an access
 	 */
-	flush_tlb_page(NULL, addr);
+	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
 
 	/* Flush page out of dcache */
 	for (cl = __pa(addr); cl < __pa(next); cl += cpuinfo->dcache_block_size)
@@ -56,7 +56,7 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
 	 * Flush the page out of the TLB so that the new page flags get
 	 * picked up next time there's an access
 	 */
-	flush_tlb_page(NULL, addr);
+	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
 
 	return 0;
 }
diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c
index e4dad76066aed..18b320a06fe56 100644
--- a/arch/openrisc/kernel/smp.c
+++ b/arch/openrisc/kernel/smp.c
@@ -261,7 +261,7 @@ static inline void ipi_flush_tlb_range(void *info)
 	local_flush_tlb_range(NULL, fd->addr1, fd->addr2);
 }
 
-static void smp_flush_tlb_range(struct cpumask *cmask, unsigned long start,
+static void smp_flush_tlb_range(const struct cpumask *cmask, unsigned long start,
 				unsigned long end)
 {
 	unsigned int cpuid;
@@ -309,7 +309,9 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
 void flush_tlb_range(struct vm_area_struct *vma,
 		     unsigned long start, unsigned long end)
 {
-	smp_flush_tlb_range(mm_cpumask(vma->vm_mm), start, end);
+	const struct cpumask *cmask = vma ? mm_cpumask(vma->vm_mm)
+					  : cpu_online_mask;
+	smp_flush_tlb_range(cmask, start, end);
 }
 
 /* Instruction cache invalidate - performed on each cpu */



[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