Commit 1110ce6a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'mm-hotfixes-stable-2025-03-08-16-27' of...

Merge tag 'mm-hotfixes-stable-2025-03-08-16-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
 "33 hotfixes. 24 are cc:stable and the remainder address post-6.13
  issues or aren't considered necessary for -stable kernels.

  26 are for MM and 7 are for non-MM.

   - "mm: memory_failure: unmap poisoned folio during migrate properly"
     from Ma Wupeng fixes a couple of two year old bugs involving the
     migration of hwpoisoned folios.

   - "selftests/damon: three fixes for false results" from SeongJae Park
     fixes three one year old bugs in the SAMON selftest code.

  The remainder are singletons and doubletons. Please see the individual
  changelogs for details"

* tag 'mm-hotfixes-stable-2025-03-08-16-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (33 commits)
  mm/page_alloc: fix uninitialized variable
  rapidio: add check for rio_add_net() in rio_scan_alloc_net()
  rapidio: fix an API misues when rio_add_net() fails
  MAINTAINERS: .mailmap: update Sumit Garg's email address
  Revert "mm/page_alloc.c: don't show protection in zone's ->lowmem_reserve[] for empty zone"
  mm: fix finish_fault() handling for large folios
  mm: don't skip arch_sync_kernel_mappings() in error paths
  mm: shmem: remove unnecessary warning in shmem_writepage()
  userfaultfd: fix PTE unmapping stack-allocated PTE copies
  userfaultfd: do not block on locking a large folio with raised refcount
  mm: zswap: use ATOMIC_LONG_INIT to initialize zswap_stored_pages
  mm: shmem: fix potential data corruption during shmem swapin
  mm: fix kernel BUG when userfaultfd_move encounters swapcache
  selftests/damon/damon_nr_regions: sort collected regiosn before checking with min/max boundaries
  selftests/damon/damon_nr_regions: set ops update for merge results check to 100ms
  selftests/damon/damos_quota: make real expectation of quota exceeds
  include/linux/log2.h: mark is_power_of_2() with __always_inline
  NFS: fix nfs_release_folio() to not deadlock via kcompactd writeback
  mm, swap: avoid BUG_ON in relocate_cluster()
  mm: swap: use correct step in loop to wait all clusters in wait_for_allocation()
  ...
parents b7c90e3e 8fe9ed44
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -691,6 +691,7 @@ Subbaraman Narayanamurthy <quic_subbaram@quicinc.com> <subbaram@codeaurora.org>
Subhash Jadavani <subhashj@codeaurora.org>
Sudarshan Rajagopalan <quic_sudaraja@quicinc.com> <sudaraja@codeaurora.org>
Sudeep Holla <sudeep.holla@arm.com> Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Sumit Garg <sumit.garg@kernel.org> <sumit.garg@linaro.org>
Sumit Semwal <sumit.semwal@ti.com>
Surabhi Vishnoi <quic_svishnoi@quicinc.com> <svishnoi@codeaurora.org>
Sven Eckelmann <sven@narfation.org> <seckelmann@datto.com>
+3 −3
Original line number Diff line number Diff line
@@ -12875,7 +12875,7 @@ F: include/keys/trusted_dcp.h
F:	security/keys/trusted-keys/trusted_dcp.c
KEYS-TRUSTED-TEE
M:	Sumit Garg <sumit.garg@linaro.org>
M:	Sumit Garg <sumit.garg@kernel.org>
L:	linux-integrity@vger.kernel.org
L:	keyrings@vger.kernel.org
S:	Supported
@@ -17675,7 +17675,7 @@ F: Documentation/ABI/testing/sysfs-bus-optee-devices
F:	drivers/tee/optee/
OP-TEE RANDOM NUMBER GENERATOR (RNG) DRIVER
M:	Sumit Garg <sumit.garg@linaro.org>
M:	Sumit Garg <sumit.garg@kernel.org>
L:	op-tee@lists.trustedfirmware.org
S:	Maintained
F:	drivers/char/hw_random/optee-rng.c
@@ -23288,7 +23288,7 @@ F: include/media/i2c/tw9910.h
TEE SUBSYSTEM
M:	Jens Wiklander <jens.wiklander@linaro.org>
R:	Sumit Garg <sumit.garg@linaro.org>
R:	Sumit Garg <sumit.garg@kernel.org>
L:	op-tee@lists.trustedfirmware.org
S:	Maintained
F:	Documentation/ABI/testing/sysfs-class-tee
+25 −12
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static int do_adjust_pte(struct vm_area_struct *vma, unsigned long address,
}

static int adjust_pte(struct vm_area_struct *vma, unsigned long address,
		      unsigned long pfn, struct vm_fault *vmf)
		      unsigned long pfn, bool need_lock)
{
	spinlock_t *ptl;
	pgd_t *pgd;
@@ -99,12 +99,11 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address,
	if (!pte)
		return 0;

	if (need_lock) {
		/*
	 * If we are using split PTE locks, then we need to take the page
	 * lock here.  Otherwise we are using shared mm->page_table_lock
	 * which is already locked, thus cannot take it.
		 * Use nested version here to indicate that we are already
		 * holding one similar spinlock.
		 */
	if (ptl != vmf->ptl) {
		spin_lock_nested(ptl, SINGLE_DEPTH_NESTING);
		if (unlikely(!pmd_same(pmdval, pmdp_get_lockless(pmd)))) {
			pte_unmap_unlock(pte, ptl);
@@ -114,7 +113,7 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address,

	ret = do_adjust_pte(vma, address, pfn, pte);

	if (ptl != vmf->ptl)
	if (need_lock)
		spin_unlock(ptl);
	pte_unmap(pte);

@@ -123,9 +122,10 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address,

static void
make_coherent(struct address_space *mapping, struct vm_area_struct *vma,
	      unsigned long addr, pte_t *ptep, unsigned long pfn,
	      struct vm_fault *vmf)
	      unsigned long addr, pte_t *ptep, unsigned long pfn)
{
	const unsigned long pmd_start_addr = ALIGN_DOWN(addr, PMD_SIZE);
	const unsigned long pmd_end_addr = pmd_start_addr + PMD_SIZE;
	struct mm_struct *mm = vma->vm_mm;
	struct vm_area_struct *mpnt;
	unsigned long offset;
@@ -141,6 +141,14 @@ make_coherent(struct address_space *mapping, struct vm_area_struct *vma,
	 */
	flush_dcache_mmap_lock(mapping);
	vma_interval_tree_foreach(mpnt, &mapping->i_mmap, pgoff, pgoff) {
		/*
		 * If we are using split PTE locks, then we need to take the pte
		 * lock. Otherwise we are using shared mm->page_table_lock which
		 * is already locked, thus cannot take it.
		 */
		bool need_lock = IS_ENABLED(CONFIG_SPLIT_PTE_PTLOCKS);
		unsigned long mpnt_addr;

		/*
		 * If this VMA is not in our MM, we can ignore it.
		 * Note that we intentionally mask out the VMA
@@ -151,7 +159,12 @@ make_coherent(struct address_space *mapping, struct vm_area_struct *vma,
		if (!(mpnt->vm_flags & VM_MAYSHARE))
			continue;
		offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
		aliases += adjust_pte(mpnt, mpnt->vm_start + offset, pfn, vmf);
		mpnt_addr = mpnt->vm_start + offset;

		/* Avoid deadlocks by not grabbing the same PTE lock again. */
		if (mpnt_addr >= pmd_start_addr && mpnt_addr < pmd_end_addr)
			need_lock = false;
		aliases += adjust_pte(mpnt, mpnt_addr, pfn, need_lock);
	}
	flush_dcache_mmap_unlock(mapping);
	if (aliases)
@@ -194,7 +207,7 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma,
		__flush_dcache_folio(mapping, folio);
	if (mapping) {
		if (cache_is_vivt())
			make_coherent(mapping, vma, addr, ptep, pfn, vmf);
			make_coherent(mapping, vma, addr, ptep, pfn);
		else if (vma->vm_flags & VM_EXEC)
			__flush_icache_all();
	}
+4 −2
Original line number Diff line number Diff line
@@ -44,8 +44,10 @@ static inline pgd_t * pgd_alloc(struct mm_struct *mm)
	pgd_t *new_pgd;

	new_pgd = __pgd_alloc(mm, 0);
	if (likely(new_pgd != NULL)) {
		memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
		memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT));
	}
	return new_pgd;
}

+2 −1
Original line number Diff line number Diff line
@@ -1742,7 +1742,8 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
		err = rio_add_net(net);
		if (err) {
			rmcd_debug(RDEV, "failed to register net, err=%d", err);
			kfree(net);
			put_device(&net->dev);
			mport->net = NULL;
			goto cleanup;
		}
	}
Loading