Commit Graph

9609 Commits

Author SHA1 Message Date
Linus Torvalds
857c32a3b8 m68knommu: updates and fixes for v7.4
. plaform RNG driver for ColdFire 54418
 . PWM address defines for ColdFire 54418
 . fix secomp filtering
 . fix compile breakage for Cleopatra board
 . update stmark defconfig
 . remove unused header
 . fix typos
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEmsfM6tQwfNjBOxr3TiQVqaG9L4AFAmreifUQHGdlcmdAa2Vy
 bmVsLm9yZwAKCRBOJBWpob0vgNJ3D/9GJp2YBm9nP7q5Swb+zPpHLhcgKNRNBqUs
 ANcVt3ASod/SuhsBEMLOlI0rC48i1OPPQHsnQmbcBGNKvbL0kxbx2PFIx/vnW1RR
 X/yrdwPbxzFbvgtPujEkDNIBEqgJmhO+kd8TBIZvVdHkshU0quRZrTuw0QKYOhyF
 AAQeJJPsbyr87HuosJEkgqkhMICQB6OrN5H4/w+ynriMA8gB1yQFIkb/+a4fvevm
 gYuFjXz8XyohlCixDL/w3W+fmqLZNKdM4E3Bs7eSP+23wEGOAaIeh6dGVw7g19Ci
 0vWZOV6/Bsn1l7dGoy0bFxN3BdbVhtXmZcDg/EE3NzXetppopN6ZkMSKO8ZOcASz
 TbhHbgPSlSCPUeD2RaKm0Wlw99NIvJsDai6LkAvk/zWHe+M6FJmdWqYdssUNAUfg
 LOeapidiPoMS8BBa25hM2zVO1ybpYGmVjzizf7oQ0Jxets/sDPRaRdhX6XwwA9u+
 //GOVN7ojim23BbqN/bK7FMlH6W8JwJfPNCklXksX0NZHemuMjyoLZULEUVltQYS
 icMcgR1Ts/q2TAxZxl3BYCjpv5bFu5XFAqQaC2G0Abxwf/n73jviRx2XzKr5MRGp
 8fDYR3wntVeWKz2Nu8fNj7HLp/aZBBwRuZdeVhSZ/UZOE+TyI3iCMauNWQsw+QSf
 l88OAreo5g==
 =fBm8
 -----END PGP SIGNATURE-----

Merge tag 'm68knommu-for-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

Pull m68knommu updates from Greg Ungerer:
 "Platform code added for the ColdFire 54418 RNG hardware block. Also
  PWM address definitions for the 54418. A fix for seccomp filter
  processing during system call entry and a fix for compiling the
  Cleopatra board target. A config update for the stmark board, and
  lastly a couple of typo fixes"

* tag 'm68knommu-for-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k: coldfire: Add RNG support for MCF54418
  m68k: mcf5441x: add PWM defines
  m68knommu: fix compile breakage for 5407 cleopatra board
  m68k: defconfig: update stmark2 defconfig
  m68k: Fix seccomp filtering on ColdFire and 68000
  m68k: remove unused <asm/quicc_simple.h> header
  m68k: fix typo "eanble" in comment
  m68k: coldfire: fix typos in reset.c comment
2026-10-27 15:06:53 -10:00
Linus Torvalds
b2c505e0ae [GIT PULL] TPM DEVICE DRIVER changes for v7.4-rc1
I had to revise my pull request because it came out with a stale tag.
 Apologies for that. While at it I refined my scripts to not have coherency
 issues.
 
 All the content remains the same with no changes but I noticed one entry
 missing from the list in the next section, so I added that.
 
 FEATURES AND IMPROVEMENTS
 =========================
 
 - tpm_crb behaviour was improved by putting the chip into an idle state for
   each transmission. This improves firmware behavior as the kernel now
   better cancels its state as if it had never touched it in the first
   place.
 - One spurious (but harmless) wmb() was dropped from tpm_pm_resume().
 - tpm_tis_i2c now requests the optional reset control and deasserts it
   before communicating with the TPM.
 - SIMPLE_DEV_PM_OPS was replaced with DEFINE_SIMPLE_DEV_PM_OPS across the
   whole driver stack.
 - Validate during driver initialization that no duplicate banks are
   received. It's unlikely corruption but since it happening would
   cause oops I decided to retain it as a sanity check.
 
 BUGS
 ====
 
 - tpm2_probe() misinterpreted a transport error on TPM2_GetCapability
   as the chip not being probed, and the chip was detected as a TPM 1 chip.
   This can happen in reality only in the extremely rare case of bus
   corruption. Despite the odds, a fix was landed, as it is still
   technically a legit bug fix.
 - It is not really worth the time and energy to go into details as tpm_nsc
   is a somewhat legacy driver, but one null pointer dereference bug and
   another causing use-after-free were fixed.
 - read() of /dev/tpm{,rm}0 with zero size caused a pending response to be
   consumed. This was fixed simply by an immediate return.
 
 Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRE6pSOnaBC00OEHEIaerohdGur0gUCatubHQAKCRAaerohdGur
 0u0kAP9hupprwx1RnquuA9+CeppOjWPJf0JMmUvbkbuFosi8tAD9FmhYqD06GKMX
 Sle3QvLNucnPvQfD4i9kR90FzzbXJgs=
 =Zeog
 -----END PGP SIGNATURE-----

Merge tag 'tpm-v7.4-rc1-rebased' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd

Pull TPM updates from Jarkko Sakkinen:
 "Features and Improvements:

   - improve tpm_crb behaviour by putting the chip into an idle state
     for each transmission. This improves firmware behavior as the
     kernel now better cancels its state as if it had never touched it
     in the first place.

   - Drop a spurious (but harmless) wmb() from tpm_pm_resume().

   - tpm_tis_i2c now requests the optional reset control and deasserts
     it before communicating with the TPM.

   - replace SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS across the
     whole driver stack.

   - Validate during driver initialization that no duplicate banks are
     received. It's unlikely corruption but since it happening would
     cause oops I decided to retain it as a sanity check.

  Bug fixes:

   - tpm2_probe() misinterpreted a transport error on TPM2_GetCapability
     as the chip not being probed, and the chip was detected as a TPM 1
     chip.

     This can happen in reality only in the extremely rare case of bus
     corruption. Despite the odds, a fix was landed, as it is still
     technically a legit bug fix.

   - It is not really worth the time and energy to go into details as
     tpm_nsc is a somewhat legacy driver, but one null pointer
     dereference bug and another causing use-after-free were fixed.

   - read() of /dev/tpm{,rm}0 with zero size caused a pending response
     to be consumed. Just return immediately"

* tag 'tpm-v7.4-rc1-rebased' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
  tpm: reject duplicate PCR banks in tpm2_get_pcr_allocation
  tpm: use DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr()
  char: tpm: Use SIMPLE_DEV_PM_OPS for ibmvtpm power management
  tpm: tis_i2c: Deassert optional reset line before probing
  tpm: Remove ineffective wmb() from tpm_pm_resume()
  tpm: Call cmd_ready/go_idle for each command transmission
  tpm: fix zero-length read discarding the pending response
  tpm: tpm_nsc: stop using the cleanup callback as dev.release
  tpm: tpm_nsc: fix NULL pointer dereference on init failure
  tpm: tpm2_probe: propagate transport errors
2026-10-26 06:55:13 -10:00
Linus Torvalds
330517c63a Char/Misc/IIO/others driver changes for 7.4-rc1
Here is the big set of char/misc/android/iio and other small driver
 subsystem patches for 7.4-rc1.  Loads of stuff in here, larger than
 normal.  Highlights include:
   - removal of the C binder code, the rust version is stable and will be
     used going forward in a few billion devices.  Great job by those
     developers.
   - loads and loads of IIO driver updates and feature additions
   - speakup driver fixes and updates
   - mhi driver updates
   - mei driver updates
   - xillybus driver fixes
   - comedi driver fixes
   - lots of coresight driver updates
   - Interconnect driver updates
   - nvmem driver updates and fixes
   - slimbus driver updates and fixes
   - spmi driver updates and fixes
   - lots of tiny misc and char driver fixes based on people scanning for
     things.
 
 All of these have been in linux-next for a while with no reported
 issues, other than a merge conflict with one of the rust tree files,
 which should be simple to resolve.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCatoRcw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykFeACgnRxMgD7VH8duyUtfTnaU+Mw8REMAni1iFmLx
 IOZYy7rCdaO/rBSm4TEK
 =OOpW
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull Char/Misc/IIO/others driver updates from Greg KH:
 "Here is the big set of char/misc/android/iio and other small driver
  subsystem patches for 7.4-rc1. Loads of stuff in here, larger than
  normal. Highlights include:

   - removal of the C binder code, the rust version is stable and will
     be used going forward in a few billion devices. Great job by those
     developers

   - loads and loads of IIO driver updates and feature additions

   - speakup driver fixes and updates

   - mhi driver updates

   - mei driver updates

   - xillybus driver fixes

   - comedi driver fixes

   - lots of coresight driver updates

   - Interconnect driver updates

   - nvmem driver updates and fixes

   - slimbus driver updates and fixes

   - spmi driver updates and fixes

   - lots of tiny misc and char driver fixes based on people scanning
     for things

  All of these have been in linux-next for a while with no reported
  issues, other than a merge conflict with one of the rust tree files,
  which should be simple to resolve"

* tag 'char-misc-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (446 commits)
  rust_binder: wake epoll on self-work queued to poll thread
  rust_binder: avoid overflow in get_node_debug_info()
  MAINTAINERS: Add Abel as SPMI co-maintainer
  spmi: mtk-pmif: Fix clock reference leak in mtk_spmi_bus_probe()
  iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions
  iio: adc: qcom-spmi-iadc: Migrate to devm_spmi_subdevice_alloc_and_add()
  misc: qcom-coincell: Migrate to devm_spmi_subdevice_alloc_and_add()
  phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add()
  power: reset: qcom-pon: Migrate to devm_spmi_subdevice_alloc_and_add()
  nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add()
  spmi: Add helper to get a parent SPMI device
  spmi: Implement spmi_subdevice_alloc_and_add() and devm variant
  spmi: Remove unneeded goto in spmi_device_add() error path
  spmi: Print error status with %pe format
  spmi: Remove redundant dev_name() print in spmi_device_add()
  spmi: Fix potential use-after-free by grabbing of_node reference
  spmi: mtk-pmif: Add workaround for FSM lockup/error in read operation
  MAINTAINERS: Add Qualcomm SPMI controller entry
  spmi: pmic-arb: return 0 in spmi_pmic_arb_register_buses() on success
  comedi: addi_apci_3xxx: fix subdevice count underallocation
  ...
2026-10-24 15:44:26 -10:00
Linus Torvalds
c5fd5e67c7 mm.git review status for linus..mm-stable
Everything:
 
 Total patches:       539
 Fixes: tags:         101
 cc:stable patches:   67
 Reviews/patch:       1.62
 Reviewed rate:       76%
 
 Excluding DAMON:
 
 Total patches:       407
 Fixes: tags:         84
 cc:stable patches:   44
 Reviews/patch:       2.00
 Reviewed rate:       87%
 
 Excluding DAMON and selftests:
 
 Total patches:       360
 Fixes: tags:         78
 cc:stable patches:   44
 Reviews/patch:       2.02
 Reviewed rate:       89%
 
 Summary of patch series in this merge, ordered by descending size:
 
 - "selftests/mm: improve khugepaged coverage" (Kiryl Shutsemau (Meta)):
 
   Give khugepaged a proper workout.  Extend the tests to all supported mTHP
   orders, check exactly which windows collapsed, and make scan completion
   deterministic.  Race collapse against faults, pinning, fork and remap;
   verify that the contents survive.
 
   Add coverage for whole-page-table zaps and memory pressure too.
 
 - "selftests/mm: separate GUP microbenchmarking from functional testing"
   (Sarthak Sharma):
 
   Untangle GUP benchmarking from correctness testing.  Move the benchmark
   into tools/mm, add a standalone harness-based GUP selftest, and move shared
   helpers into tools/lib/mm.  Give each tool one job instead of mixing timing
   measurements with correctness checks.
 
   Cover the mapping, pinning and batch-size combinations explicitly.
 
 - "mm: Switch device DAX to section-based vmemmap optimization" (Muchun Song):
 
   Apply section-based vmemmap optimization to device DAX.  Rework the backing
   metadata layout to save memory while preserving the handling of device
   memory hotplug and its different alignment and lifetime requirements.
 
 - "mm: Introduce section-based vmemmap optimization for HugeTLB" (Muchun
   Song):
 
   Cut the memory consumed by HugeTLB's struct page array with section-based
   vmemmap optimization.  Arrange the metadata so large huge pages need fewer
   backing pages, while keeping initialization, teardown and the various
   hugepage configurations straight.
 
 - "mm/huge_memory: clean up and decouple the anon and file split helpers"
   (Kairui Song):
 
   Separate anonymous and file-backed folio splitting, which have rather
   different locking and bookkeeping requirements.  Move the work into
   separate helpers, drop dead checks and tidy swap-cache handling.  Fix error
   paths, including one that could leave a folio frozen.
 
   Keep the swap cache cases separate from file-cache splitting.
 
 - "mm: Unconditional per-VMA locks and cleanups" (Dave Hansen):
 
   Make per-VMA locking unconditional and clean up the old conditional code
   around it.  This removes configuration-dependent plumbing and lets callers
   depend on one locking model rather than carrying both cases along.
 
 - "memcg: remove the v1 soft limit" (Shakeel Butt):
 
   Remove the old cgroup v1 memory soft-limit machinery.  This has long since
   been superseded by the newer memory-control interfaces; hauling around a
   separate reclaim scheme for it no longer buys us much.
 
 - "read proc/pid/smaps_rollup under per-vma lock" (Suren Baghdasaryan):
 
   Read /proc/PID/smaps_rollup using per-VMA locks where possible, rather than
   holding mmap_lock across the entire walk.  Retain the contention fallback
   and add tearing tests.  This considerably reduces latency when another
   thread is busy changing its mappings.
 
 - "mm/damon: introduce data access-as-a-data attribute" (SJ Park):
 
   Teach DAMON to expose memory access observations as data attributes, making
   them available to the probe and filtering machinery.  Extend the
   interfaces, documentation and tests so the new information can be used
   rather than merely collected.
 
 - "Remove PG_private by using page/folio->private checks instead" (Zi Yan):
 
   Get rid of PG_private and use the folio's private pointer to say whether
   private data is attached.  Convert the filesystem users, including erofs,
   f2fs and md, and clean up the old accessors and flags.  There are a few
   special cases, notably swapcache and hugetlb, which need explicit care.
 
 - "mm: make userland page table freeing RCU-safe" (Lorenzo Stoakes (ARM)):
 
   Make freeing userspace page tables safe against RCU readers.  Sort out the
   page-table lifetime and locking rules so walkers cannot stumble over freed
   tables while mappings are being torn down.
 
 - "make unused huge shrinker memcg aware" (Qi Zheng):
 
   Make shmem's unused-huge-folio shrinker aware of memory cgroups, so reclaim
   can find those folios under the right memcg.  Wire up the per-memcg
   tracking and its lifetime rules, and give the shrinklist its own lockdep
   class to avoid spurious dependency reports.
 
 - "mm: Drop pxd_ERROR()" (Anshuman Khandual):
 
   Remove the old pxd_ERROR() page-table checks and their
   architecture-specific baggage.  Simplify the common page-table interfaces
   and callers now that these checks no longer serve a useful purpose.
 
 - "memcg: group struct fields by access pattern" (Shakeel Butt):
 
   Rearrange memcg's hot and cold fields according to how they're actually
   accessed.  Keep frequently updated counters and their neighboring state
   from fighting over cachelines and reduce needless cacheline traffic.
 
 - "mm/damon/core: fix the size charged for a filter-trimmed region" (Donggeun
   Yoo):
 
   Fix DAMOS quota accounting when a filter trims a monitoring region.  Charge
   only the part left after filtering, not the original region, and add KUnit
   coverage.  Previously the excluded memory could eat into the quota and make
   schemes run more slowly than requested.
 
 - "mm/damon: add kunit and selftests for probes and probe weights" (SJ Park):
 
   Add more tests for DAMON probes and their weights, including validation and
   the results reported to userspace.  This is mostly about catching
   regressions in the newer probe infrastructure before they become harder to
   diagnose.
 
 - "mm: memcontrol: constify the read side of the read side of the memcg API"
   (Tal Zussman):
 
   Mark the read-only parts of the memcg interface const, from folio and
   lruvec accessors to counters and swap helpers.  Most of this is mechanical,
   but it makes the contracts clearer and lets the compiler catch accidental
   writes.
 
 - "mm/damon/vaddr: support {prep,apply}_probes" (SJ Park):
 
   Support the new prepare/apply probe operations in DAMON's virtual-address
   backend.  This brings vaddr monitoring into line with the probe
   infrastructure and makes the added probe types useful there too.
 
 - "mm/mglru: clean up folio counters and flag usage" (Kairui Song):
 
   Simplify MGLRU's folio counters and flag handling.  Remove redundant
   accounting paths and make the state transitions easier to follow without
   changing the intended reclaim policy.
 
 - "arch, mm/execmem: resolve confusion about set_direct_map_valid_noflush()"
   (Mike Rapoport (Microsoft)):
 
   Clarify and straighten out the set_direct_map_valid_noflush() interface
   across architectures and execmem.  Make the requested mapping changes and
   the callers' expectations agree, rather than relying on subtly different
   architecture behavior.
 
 - "mm: zswap: free cold writeback folios promptly" (Alexandre Ghiti):
 
   Free zswap writeback folios as soon as their disk write completes.  They
   are cold temporary buffers, so putting them on the LRU only makes reclaim
   rediscover them later.  Extend swap-cache dropbehind and let zswap keep
   these folios off the LRU altogether.
 
 - "mm: gup: cleanup gup_fast call chain" (Aristeu Rozanski):
 
   Clean up the GUP-fast call chain and simplify how the fast-path helpers
   pass their arguments and results around.  Keep the page-pin behavior the
   same while making the call sequence easier to maintain.
 
 - "mm: optimize zone-device memmap initialization" (Li Zhe):
 
   Speed up initialization of zone-device struct pages.  Avoid redundant work
   when setting up large device-memory ranges, where touching every descriptor
   can get expensive.
 
 - "mm/zswap: shrink zswap_entry via a pool id" (Jianyue Wu):
 
   Reduce the size of zswap_entry by storing a compact pool identifier instead
   of a full pointer.  Keep the pool lookup and lifetime handling correct
   while saving per-entry metadata.
 
 - "mm/damon: support access monitoring of hugetlb-backed memory" (Krishna
   Iyer):
 
   Let DAMON monitor hugetlb-backed memory too.  Extend the relevant access
   checks and add coverage so those mappings no longer fall through a hole in
   the monitoring machinery.
 
 - "mm/execmem: fixes and cleanups for the ROX cache" (Mike Rapoport
   (Microsoft)):
 
   Tidy execmem's read-only-executable cache and fix its handling of the
   awkward allocation and release cases.  The aim is to make the cache's
   ownership and permission transitions more predictable.
 
 - "zsmallc: remove old object read API" (Sergey Senozhatsky):
 
   Drop zsmalloc's old object-read API and move its remaining users to the
   supported access mechanism.  This removes a duplicate interface which we no
   longer need.
 
 - "mm/mempolicy: stop copying state in the interleave paths" (Gregory Price):
 
   Stop copying mempolicy state in the interleave paths when a reference to
   the existing policy will do.  This avoids extra work and makes the
   ownership rules less obscure.
 
 - "mm/mglru: speed up inc_min_seq() and fix cold/hot inversions" (Barry Song
   (Xiaomi)):
 
   Make MGLRU's generation advancement cheaper and fix cases where cold and
   hot folios end up in the wrong order.  Adjust the counter and list handling
   so reclaim doesn't keep passing over the better eviction candidates.
 
 - "mm: Fix MF_DELAYED handling on memory failure" (Lisa Wang):
 
   Treat MF_DELAYED as a partially completed memory-failure operation, not an
   outright failure.  Propagate that result correctly through shmem and the
   generic handler, fix the extra-reference accounting, and add tests for the
   resulting SIGBUS behavior.
 
 - "tools/mm/page_owner_sort: fix --sort, add module filter, improve usage" (Ye
   Liu):
 
   Fix page_owner_sort's --sort handling, add module-based filtering and make
   the usage output more helpful.  This makes the tool less frustrating when
   tracking down who is holding on to pages.
 
 - "mm/damon: move damos filter range arguments validation to core" (SJ Park):
 
   Move DAMOS filter range validation into the core, where all callers can
   share it.  Also close the sysfs read-twice races which could pass
   inconsistent ranges, and add tests for invalid input.
 
 - "mm/damon: misc cleanups" (Zenghui Yu (Huawei)):
 
   Clean up a collection of small DAMON rough edges in the core, interfaces
   and tests.  No large behavior change here, just simpler code and fewer
   opportunities for confusion.
 
 - "mm/damon: cleanup code, add test cases, and update guidances in docs" (SJ
   Park):
 
   Clean up DAMON's core and interfaces, add missing test cases and bring the
   documentation into line with the code.  These changes should make the newer
   facilities easier to understand and maintain.
 
 - "mm/damon: introduce hugepage_size probe filter" (SJ Park):
 
   Add a DAMON probe filter for hugepage size.  Let users select a range of
   folio sizes through sysfs, validate the range and document the new
   interface, so monitoring can concentrate on memory backed by the desired
   hugepage sizes.
 
 - "selftests/mm: pagemap_ioctl test fixes and cleanups" (Zenghui Yu (Huawei)):
 
   Fix some pagemap ioctl test assumptions and clean up their setup and
   reporting.  Make failures point to the operation that went wrong rather
   than to test harness bookkeeping.
 
 - "mm: avoid large folio splits when swap is unavailable" (Johannes Weiner):
 
   Avoid splitting large folios merely to attempt swap when no swap space is
   available.  There is little point paying for an expensive split when
   reclaim cannot actually swap the resulting pages out.
 
 - "mm: workingset: fix the shadow node budget under MGLRU" (Hui Zhu):
 
   Fix the workingset shadow-node budget with MGLRU enabled.  Keep the shadow
   entries within the intended limits so refault tracking does not quietly
   consume more metadata than it should.
 
 - "selftests/mm: TAP output and global-state fixes" (Song Hu):
 
   Fix selftests which produce misleading TAP output or fail to restore global
   settings after a run.  A test ought to leave the system as it found it,
   particularly when a whole suite follows behind.
 
 - "mm: remove page_swap_entry()" (Tal Zussman):
 
   Remove page_swap_entry() and convert its remaining users to the folio and
   swap-entry helpers.  Lose an old page-level interface and make the swap
   paths a little more consistent.
 
 - "mm: refactor zonelist constructors and iterators" (Gregory Price):
 
   Refactor the zonelist construction and walk helpers to reduce duplicated
   logic.  Keep the allocation ordering rules intact while making it clearer
   how zones are selected.
 
 - "mm: kmemleak: batch the struct page scan" (Breno Leitao):
 
   Scan adjacent struct pages in batches instead of taking kmemleak_lock once
   for every single page.  This preserves scan coverage and the lock-hold
   bound, while cutting overhead substantially on debug kernels.
 
 - "mm/damon: misc improvements in tests and documents" (Zenghui Yu (Huawei)):
 
   Fix some DAMON selftests which leave kdamond running or fail under Python
   safe-path mode, and improve the KUnit coverage and documentation.  Nothing
   especially glamorous, but these are worth doing.
 
 - "mm/damon: introduce probe_hits_wsum DAMOS core filter" (SJ Park):
 
   Add a DAMOS core filter using weighted probe-hit counts.  This gives
   schemes another way to select regions based on what the monitoring probes
   observed.
 
 - "mm/mglru: fix ineffective memory protection for non-kswapd reclaim" (Ridong
   Chen):
 
   Fix MGLRU's memory protection handling for reclaim outside kswapd.  The
   protection settings weren't having the intended effect in these paths,
   leaving protected memory more exposed than requested.
 
 - "mm/damon: improve readability, clarity and test coverage" (SJ Park):
 
   Simplify a handful of DAMON core helpers, clarify their behavior and expand
   test coverage.  There are no intended userspace-visible changes in this
   batch.
 
 - "mm: replace PF_KCOMPACTD/PF_KSWAPD with kthread_func()" (Kefeng Wang):
 
   Stop identifying reclaim and compaction workers through the PF_KSWAPD and
   PF_KCOMPACTD task flags.  Use their kthread functions instead and remove
   the redundant flag plumbing.
 
 - "mm/hugetlb: fix surplus accounting and availability checks during demotion"
   (Longlong Xia):
 
   Fix HugeTLB surplus accounting and availability checks when demoting huge
   pages.  Keep the counters and reservation decisions consistent as one huge
   page turns into several smaller ones.
 
 - "mm/damon: add kunit tests for probe_hits handling and probe params
   validation" (Jason Angelov):
 
   Add KUnit tests for DAMON probe-hit handling and invalid probe parameters.
   These cover edge cases that were too easy to miss in ordinary monitoring
   tests.
 
 - "mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms" (SJ
   Park):
 
   Fix a few DAMON bugs in KUnit tests, quota-goal handling and the sysfs
   refresh interval.  Small fixes, but the incorrect results and control
   behavior were real.
 
 - "mm: zswap: optimize zswap invalidate and store" (Kefeng Wang):
 
   Simplify zswap's invalidate and store paths to avoid avoidable lookups and
   work.  Keep the entry lifetime rules intact while making those frequent
   operations cheaper.
 
 - "mm: replace custom ratelimiting logic" (Pedro Falcato):
 
   Replace hand-rolled MM rate limiting with the common kernel helpers.  There
   is no need to maintain another local version of the same mechanism.
 
 - "mm/vmalloc: minor cleanups" (Ye Liu):
 
   Tidy some vmalloc initialization and reporting code, and pull duplicated
   vmap-area insertion work into a helper.  No functional changes are
   intended.
 
 - "mm/mglru: clean up isolate_folios for readability and clarity" (Ridong
   Chen):
 
   Clean up MGLRU's isolate_folios() so the decisions are easier to read and
   verify.  Keep reclaim behavior unchanged while removing unnecessary twists
   in the control flow.
 
 - "Catch automatic storage in IDA and Maple Tree definitions" (Yury Norov):
 
   Catch IDA and maple-tree definitions placed in automatic storage where the
   lifetime rules are wrong or easy to get wrong.  Add checks so such mistakes
   are harder to slip through unnoticed.
 
 - "mm, swap: some random fixes and cleanups" (Kemeng Shi):
 
   Fix and simplify a few unrelated swap paths, removing redundant work and
   tidying up error handling.  A small collection of things which were better
   fixed than left lying around.
 
 - "mm/page_io: folio conversion cleanups" (Tal Zussman):
 
   Finish some page-to-folio conversions in swap I/O, removing obsolete
   wrappers and using folio operations consistently.  The I/O behavior is
   intended to remain the same.
 
 - "mm/swap: skip empty clusters in the swapoff scan" (Youngjun Park):
 
   Skip empty swap clusters during swapoff instead of walking slots which have
   nothing to release.  This avoids pointless work on sparsely used swap
   devices.
 
 - "mm: trace: decode architecture-specific VMA flags" (Meijing Zhao):
 
   Teach the VMA trace output to decode architecture-specific flags, rather
   than leaving them as unexplained bits.  That should make tracing a good
   deal more useful when debugging unusual mappings.
 
 - "mm, swap: don't spin on a bad swap entry" (Breno Leitao):
 
   Stop repeatedly retrying a swap entry which is already known to be bad.
   Make the error path terminate cleanly instead of wasting CPU chasing an
   entry that cannot be used.
 
 - "mm/page_isolation: fix UBSAN shift-out-of-bounds in
   isolate_single_pageblock" (Qi Xi):
 
   Fix an out-of-range shift in isolate_single_pageblock() and tighten its
   associated boundary handling.  UBSAN found the issue; the result should be
   more robust pageblock isolation.
 
 - "mm: khugepaged: fix tracepoint UAF" (Vernon Yang):
 
   Fix a use-after-free in khugepaged tracepoint handling.  Make sure the
   information recorded by tracing stays valid for as long as the trace event
   needs it.
 
 - "mm/damon: fix DAMOS bugs in core, paddr and vaddr" (SJ Park):
 
   Fix several DAMOS problems across the core and physical- and
   virtual-address backends.  The changes close error cases and bring the
   implementations back into agreement.
 
 - "mm/hugetlb_cgroup: move the per-node usage along with the folio" (Hongfu
   Li):
 
   Move HugeTLB per-node usage accounting when folios migrate between nodes or
   are reparented to another cgroup.  Otherwise numa_stat can retain stale
   charges and even underflow when the folio is freed.
 
 - "docs/core-api: memory-allocation: add k[mz]alloc_obj() and clarify kmalloc"
   (Mike Rapoport (Microsoft)):
 
   Document the typed k[mz]alloc_obj() allocation helpers and clear up some
   kmalloc guidance.  Make it easier for callers to choose the right
   interface.
 
 - "selftests/mm: Validate selections and scope memfd_secret setup" (Tianyi
   Chen):
 
   Check selftest selections before running and confine memfd_secret setup to
   the cases that actually need it.  Avoid confusing failures caused by the
   test harness itself.
 
 - "mm/damon: move zero damos quota target_value handling to the core layer"
   (SJ Park):
 
   Handle a zero DAMOS quota goal target in the core rather than making each
   user of the interface invent its own rule.  Keep quota decisions consistent
   across callers.
 
 - "mm/damon: Introduce a huge page collapsing mechanism using auto tuning"
   (Asier Gutierrez):
 
   Add an auto-tuned DAMON mechanism for collapsing huge pages.  Use
   monitoring feedback to decide when collapse is worthwhile rather than
   forcing one fixed policy onto every workload.
 
 - "kmemleak: fix stale documentation and raise the verbose default" (Breno
   Leitao):
 
   Bring the kmemleak documentation up to date and require a third confirming
   scan before verbose kernels print a suspected leak.  The extra scan helps
   suppress transient false positives in noisy debug builds.
 
 - "mm/memory: improve insert_pages() error handling" (Avi Weiss):
 
   Tighten insert_pages() error handling so partial failures are reported and
   cleaned up consistently.  The caller should not have to guess how far the
   operation got.
 
 - "mm/damon: allow NULL or unstarted damon_ctx parameter for damon_call()" (SJ
   Park):
 
   Make damon_call() handle NULL and not-yet-started contexts safely.
   Simplify the rules for callers and avoid an indefinite wait on an invalid
   state.
 
 - "mm/damon: introduce pgidle_set probe filter type" (SJ Park):
 
   Add a pgidle_set DAMON probe filter, giving monitoring users another way to
   select pages by their idle-tracking state.  Wire it through the filter
   interfaces and tests.
 
 - "mm/damon/core: remove unused helper functions" (Cheng-Han Wu):
 
   Remove DAMON core helpers which no longer have callers.  Keep the API
   surface smaller rather than retaining dead code just in case.
 
 - "mm: stop calling pmd_folio() on special PMDs" (Gregory Price):
 
   Avoid calling pmd_folio() on special PMD mappings that have no struct page.
   The old assumption could fault in procfs walkers; use the normal-folio
   checks and handle those mappings properly.
 
 - "mm: remove three unused helpers from mm.h" (Tal Zussman):
 
   Remove three unused helpers from mm.h.  Fewer obsolete interfaces for the
   next person to stumble over.
 
 - "mm/damon: improvements in efficiency, error handling, documents" (Liew Rui
   Yan):
 
   Skip needless DAMOS quota work once the quota is full, propagate a missing
   sysfs error and tidy a couple of comments.  The ignored error could make a
   monitoring-start request appear successful when it wasn't.
 
 - "docs/mm/damon/design: add explanation of nr_snapshots" (Liew Rui Yan):
 
   Explain DAMON's nr_snapshots accounting in the design documentation and
   straighten out the associated terminology.  Make it clearer what users
   should expect from that counter.
 
 - "selftests/cgroup: fixes for test_zswap on single core VM" (Wilson Felipe
   Pereira):
 
   Fix two test_zswap failures on single-CPU VMs.  Wait for the exiting
   child's cgroup to become unpopulated before reconfiguring it, and avoid
   another test assumption which breaks under constrained scheduling.
 
 - "docs/ksm: fix advisor documentation and comment" (Jinjiang Tu):
 
   Correct the KSM advisor documentation and a misleading code comment.  Keep
   the description aligned with how the advisor actually works.
 
 - "Fix bugs in HugeTLB allocation when mem_cgroup_charge_hugetlb() fails"
   (Ackerley Tng):
 
   Fix HugeTLB allocation cleanup when the memcg charge fails.  Make sure
   failure exits undo what was allocated rather than leaving stale accounting
   or resources behind.
 
 - "mm, memcg: fix memory.peak reset clobbering other fds' watermark" (Ridong
   Chen):
 
   Fix memory.peak reset handling so resetting one file descriptor doesn't
   overwrite the watermark kept for another.  Keep those per-open measurements
   independent as intended.
 
 - "mm: reject zone device folios in more folio walkers" (Gregory Price):
 
   Reject zone-device folios in page walkers that cannot safely handle them.
   Extend the existing checks rather than assuming every folio has ordinary
   system-memory backing.
 
 - "percpu: remove code with no effect" (Sang-Heon Jeon):
 
   Remove a few pieces of percpu code which no longer do anything.  There is
   no reason to keep maintaining dead paths.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCatbvywAKCRDdBJ7gKXxA
 jrEfAP91yviLKCh8AEazeeBo4D65ntp0FmZB9qqCj46+YuEkowD9HPAyTpD+PjWS
 yp/lLvvS4RIg6chID4S2U/pLGzlypg4=
 =RIh/
 -----END PGP SIGNATURE-----

Merge tag 'mm-stable-2026-10-19-21-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull MM updates from Andrew Morton:

 - "selftests/mm: improve khugepaged coverage" (Kiryl Shutsemau):

   Give khugepaged a proper workout. Extend the tests to all supported
   mTHP orders, check exactly which windows collapsed, and make scan
   completion deterministic. Race collapse against faults, pinning, fork
   and remap; verify that the contents survive.

   Add coverage for whole-page-table zaps and memory pressure too.

 - "selftests/mm: separate GUP microbenchmarking from functional testing"
   (Sarthak Sharma):

   Untangle GUP benchmarking from correctness testing. Move the
   benchmark into tools/mm, add a standalone harness-based GUP selftest,
   and move shared helpers into tools/lib/mm. Give each tool one job
   instead of mixing timing measurements with correctness checks.

   Cover the mapping, pinning and batch-size combinations explicitly.

 - "mm: Switch device DAX to section-based vmemmap optimization" (Muchun
   Song):

   Apply section-based vmemmap optimization to device DAX. Rework the
   backing metadata layout to save memory while preserving the handling
   of device memory hotplug and its different alignment and lifetime
   requirements.

 - "mm: Introduce section-based vmemmap optimization for HugeTLB"
   (Muchun Song):

   Cut the memory consumed by HugeTLB's struct page array with
   section-based vmemmap optimization. Arrange the metadata so large
   huge pages need fewer backing pages, while keeping initialization,
   teardown and the various hugepage configurations straight.

 - "mm/huge_memory: clean up and decouple the anon and file split
   helpers" (Kairui Song):

   Separate anonymous and file-backed folio splitting, which have rather
   different locking and bookkeeping requirements. Move the work into
   separate helpers, drop dead checks and tidy swap-cache handling. Fix
   error paths, including one that could leave a folio frozen.

   Keep the swap cache cases separate from file-cache splitting.

 - "mm: Unconditional per-VMA locks and cleanups" (Dave Hansen):

   Make per-VMA locking unconditional and clean up the old conditional
   code around it. This removes configuration-dependent plumbing and
   lets callers depend on one locking model rather than carrying both
   cases along.

 - "memcg: remove the v1 soft limit" (Shakeel Butt):

   Remove the old cgroup v1 memory soft-limit machinery. This has long
   since been superseded by the newer memory-control interfaces; hauling
   around a separate reclaim scheme for it no longer buys us much.

 - "read proc/pid/smaps_rollup under per-vma lock" (Suren Baghdasaryan):

   Read /proc/PID/smaps_rollup using per-VMA locks where possible,
   rather than holding mmap_lock across the entire walk. Retain the
   contention fallback and add tearing tests. This considerably reduces
   latency when another thread is busy changing its mappings.

 - "mm/damon: introduce data access-as-a-data attribute" (SJ Park):

   Teach DAMON to expose memory access observations as data attributes,
   making them available to the probe and filtering machinery. Extend
   the interfaces, documentation and tests so the new information can be
   used rather than merely collected.

 - "Remove PG_private by using page/folio->private checks instead" (Zi
   Yan):

   Get rid of PG_private and use the folio's private pointer to say
   whether private data is attached. Convert the filesystem users,
   including erofs, f2fs and md, and clean up the old accessors and
   flags. There are a few special cases, notably swapcache and hugetlb,
   which need explicit care.

 - "mm: make userland page table freeing RCU-safe" (Lorenzo Stoakes):

   Make freeing userspace page tables safe against RCU readers. Sort out
   the page-table lifetime and locking rules so walkers cannot stumble
   over freed tables while mappings are being torn down.

 - "make unused huge shrinker memcg aware" (Qi Zheng):

   Make shmem's unused-huge-folio shrinker aware of memory cgroups, so
   reclaim can find those folios under the right memcg. Wire up the
   per-memcg tracking and its lifetime rules, and give the shrinklist
   its own lockdep class to avoid spurious dependency reports.

 - "mm: Drop pxd_ERROR()" (Anshuman Khandual):

   Remove the old pxd_ERROR() page-table checks and their
   architecture-specific baggage. Simplify the common page-table
   interfaces and callers now that these checks no longer serve a
   useful purpose.

 - "memcg: group struct fields by access pattern" (Shakeel Butt):

   Rearrange memcg's hot and cold fields according to how they're
   actually accessed. Keep frequently updated counters and their
   neighboring state from fighting over cachelines and reduce needless
   cacheline traffic.

 - "mm/damon/core: fix the size charged for a filter-trimmed region"
   (Donggeun Yoo):

   Fix DAMOS quota accounting when a filter trims a monitoring region.
   Charge only the part left after filtering, not the original region,
   and add KUnit coverage. Previously the excluded memory could eat into
   the quota and make schemes run more slowly than requested.

 - "mm/damon: add kunit and selftests for probes and probe weights" (SJ
   Park):

   Add more tests for DAMON probes and their weights, including
   validation and the results reported to userspace. This is mostly
   about catching regressions in the newer probe infrastructure before
   they become harder to diagnose.

 - "mm: memcontrol: constify the read side of the read side of the memcg
   API" (Tal Zussman):

   Mark the read-only parts of the memcg interface const, from folio and
   lruvec accessors to counters and swap helpers. Most of this is
   mechanical, but it makes the contracts clearer and lets the compiler
   catch accidental writes.

 - "mm/damon/vaddr: support {prep,apply}_probes" (SJ Park):

   Support the new prepare/apply probe operations in DAMON's
   virtual-address backend. This brings vaddr monitoring into line with
   the probe infrastructure and makes the added probe types useful there
   too.

 - "mm/mglru: clean up folio counters and flag usage" (Kairui Song):

   Simplify MGLRU's folio counters and flag handling. Remove redundant
   accounting paths and make the state transitions easier to follow
   without changing the intended reclaim policy.

 - "arch, mm/execmem: resolve confusion about set_direct_map_valid_noflush()"
   (Mike Rapoport (Microsoft)):

   Clarify and straighten out the set_direct_map_valid_noflush()
   interface across architectures and execmem. Make the requested
   mapping changes and the callers' expectations agree, rather than
   relying on subtly different architecture behavior.

 - "mm: zswap: free cold writeback folios promptly" (Alexandre Ghiti):

   Free zswap writeback folios as soon as their disk write completes.
   They are cold temporary buffers, so putting them on the LRU only
   makes reclaim rediscover them later. Extend swap-cache dropbehind and
   let zswap keep these folios off the LRU altogether.

 - "mm: gup: cleanup gup_fast call chain" (Aristeu Rozanski):

   Clean up the GUP-fast call chain and simplify how the fast-path
   helpers pass their arguments and results around. Keep the page-pin
   behavior the same while making the call sequence easier to maintain.

 - "mm: optimize zone-device memmap initialization" (Li Zhe):

   Speed up initialization of zone-device struct pages. Avoid redundant
   work when setting up large device-memory ranges, where touching every
   descriptor can get expensive.

 - "mm/zswap: shrink zswap_entry via a pool id" (Jianyue Wu):

   Reduce the size of zswap_entry by storing a compact pool identifier
   instead of a full pointer. Keep the pool lookup and lifetime handling
   correct while saving per-entry metadata.

 - "mm/damon: support access monitoring of hugetlb-backed memory"
   (Krishna Iyer):

   Let DAMON monitor hugetlb-backed memory too. Extend the relevant
   access checks and add coverage so those mappings no longer fall
   through a hole in the monitoring machinery.

 - "mm/execmem: fixes and cleanups for the ROX cache" (Mike Rapoport):

   Tidy execmem's read-only-executable cache and fix its handling of the
   awkward allocation and release cases. The aim is to make the cache's
   ownership and permission transitions more predictable.

 - "zsmallc: remove old object read API" (Sergey Senozhatsky):

   Drop zsmalloc's old object-read API and move its remaining users to
   the supported access mechanism. This removes a duplicate interface
   which we no longer need.

 - "mm/mempolicy: stop copying state in the interleave paths" (Gregory
   Price):

   Stop copying mempolicy state in the interleave paths when a reference
   to the existing policy will do. This avoids extra work and makes the
   ownership rules less obscure.

 - "mm/mglru: speed up inc_min_seq() and fix cold/hot inversions" (Barry
   Song):

   Make MGLRU's generation advancement cheaper and fix cases where cold
   and hot folios end up in the wrong order. Adjust the counter and list
   handling so reclaim doesn't keep passing over the better eviction
   candidates.

 - "mm: Fix MF_DELAYED handling on memory failure" (Lisa Wang):

   Treat MF_DELAYED as a partially completed memory-failure operation,
   not an outright failure. Propagate that result correctly through
   shmem and the generic handler, fix the extra-reference accounting,
   and add tests for the resulting SIGBUS behavior.

 - "tools/mm/page_owner_sort: fix --sort, add module filter, improve
   usage" (Ye Liu):

   Fix page_owner_sort's --sort handling, add module-based filtering and
   make the usage output more helpful. This makes the tool less
   frustrating when tracking down who is holding on to pages.

 - "mm/damon: move damos filter range arguments validation to core" (SJ
   Park):

   Move DAMOS filter range validation into the core, where all callers
   can share it. Also close the sysfs read-twice races which could pass
   inconsistent ranges, and add tests for invalid input.

 - "mm/damon: misc cleanups" (Zenghui Yu):

   Clean up a collection of small DAMON rough edges in the core,
   interfaces and tests. No large behavior change here, just simpler
   code and fewer opportunities for confusion.

 - "mm/damon: cleanup code, add test cases, and update guidances in
   docs" (SJ Park):

   Clean up DAMON's core and interfaces, add missing test cases and
   bring the documentation into line with the code. These changes should
   make the newer facilities easier to understand and maintain.

 - "mm/damon: introduce hugepage_size probe filter" (SJ Park):

   Add a DAMON probe filter for hugepage size. Let users select a range
   of folio sizes through sysfs, validate the range and document the new
   interface, so monitoring can concentrate on memory backed by the
   desired hugepage sizes.

 - "selftests/mm: pagemap_ioctl test fixes and cleanups" (Zenghui Yu):

   Fix some pagemap ioctl test assumptions and clean up their setup and
   reporting. Make failures point to the operation that went wrong
   rather than to test harness bookkeeping.

 - "mm: avoid large folio splits when swap is unavailable" (Johannes
   Weiner):

   Avoid splitting large folios merely to attempt swap when no swap
   space is available. There is little point paying for an expensive
   split when reclaim cannot actually swap the resulting pages out.

 - "mm: workingset: fix the shadow node budget under MGLRU" (Hui Zhu):

   Fix the workingset shadow-node budget with MGLRU enabled. Keep the
   shadow entries within the intended limits so refault tracking does
   not quietly consume more metadata than it should.

 - "selftests/mm: TAP output and global-state fixes" (Song Hu):

   Fix selftests which produce misleading TAP output or fail to restore
   global settings after a run. A test ought to leave the system as it
   found it, particularly when a whole suite follows behind.

 - "mm: remove page_swap_entry()" (Tal Zussman):

   Remove page_swap_entry() and convert its remaining users to the folio
   and swap-entry helpers. Lose an old page-level interface and make the
   swap paths a little more consistent.

 - "mm: refactor zonelist constructors and iterators" (Gregory Price):

   Refactor the zonelist construction and walk helpers to reduce
   duplicated logic. Keep the allocation ordering rules intact while
   making it clearer how zones are selected.

 - "mm: kmemleak: batch the struct page scan" (Breno Leitao):

   Scan adjacent struct pages in batches instead of taking kmemleak_lock
   once for every single page. This preserves scan coverage and the
   lock-hold bound, while cutting overhead substantially on debug
   kernels.

 - "mm/damon: misc improvements in tests and documents" (Zenghui Yu):

   Fix some DAMON selftests which leave kdamond running or fail under
   Python safe-path mode, and improve the KUnit coverage and
   documentation. Nothing especially glamorous, but these are worth
   doing.

 - "mm/damon: introduce probe_hits_wsum DAMOS core filter" (SJ Park):

   Add a DAMOS core filter using weighted probe-hit counts. This gives
   schemes another way to select regions based on what the monitoring
   probes observed.

 - "mm/mglru: fix ineffective memory protection for non-kswapd reclaim"
   (Ridong Chen):

   Fix MGLRU's memory protection handling for reclaim outside kswapd.
   The protection settings weren't having the intended effect in these
   paths, leaving protected memory more exposed than requested.

 - "mm/damon: improve readability, clarity and test coverage" (SJ Park):

   Simplify a handful of DAMON core helpers, clarify their behavior and
   expand test coverage. There are no intended userspace-visible changes
   in this batch.

 - "mm: replace PF_KCOMPACTD/PF_KSWAPD with kthread_func()" (Kefeng
   Wang):

   Stop identifying reclaim and compaction workers through the PF_KSWAPD
   and PF_KCOMPACTD task flags. Use their kthread functions instead and
   remove the redundant flag plumbing.

 - "mm/hugetlb: fix surplus accounting and availability checks during
   demotion" (Longlong Xia):

   Fix HugeTLB surplus accounting and availability checks when demoting
   huge pages. Keep the counters and reservation decisions consistent as
   one huge page turns into several smaller ones.

 - "mm/damon: add kunit tests for probe_hits handling and probe params
   validation" (Jason Angelov):

   Add KUnit tests for DAMON probe-hit handling and invalid probe
   parameters. These cover edge cases that were too easy to miss in
   ordinary monitoring tests.

 - "mm/damon: fix misc bugs in kunit, quota goals and sysfs refresh_ms"
   (SJ Park):

   Fix a few DAMON bugs in KUnit tests, quota-goal handling and the
   sysfs refresh interval. Small fixes, but the incorrect results and
   control behavior were real.

 - "mm: zswap: optimize zswap invalidate and store" (Kefeng Wang):

   Simplify zswap's invalidate and store paths to avoid avoidable
   lookups and work. Keep the entry lifetime rules intact while making
   those frequent operations cheaper.

 - "mm: replace custom ratelimiting logic" (Pedro Falcato):

   Replace hand-rolled MM rate limiting with the common kernel helpers.
   There is no need to maintain another local version of the same
   mechanism.

 - "mm/vmalloc: minor cleanups" (Ye Liu):

   Tidy some vmalloc initialization and reporting code, and pull
   duplicated vmap-area insertion work into a helper. No functional
   changes are intended.

 - "mm/mglru: clean up isolate_folios for readability and clarity"
   (Ridong Chen):

   Clean up MGLRU's isolate_folios() so the decisions are easier to read
   and verify. Keep reclaim behavior unchanged while removing
   unnecessary twists in the control flow.

 - "Catch automatic storage in IDA and Maple Tree definitions" (Yury
   Norov):

   Catch IDA and maple-tree definitions placed in automatic storage
   where the lifetime rules are wrong or easy to get wrong. Add checks
   so such mistakes are harder to slip through unnoticed.

 - "mm, swap: some random fixes and cleanups" (Kemeng Shi):

   Fix and simplify a few unrelated swap paths, removing redundant work
   and tidying up error handling. A small collection of things which
   were better fixed than left lying around.

 - "mm/page_io: folio conversion cleanups" (Tal Zussman):

   Finish some page-to-folio conversions in swap I/O, removing obsolete
   wrappers and using folio operations consistently. The I/O behavior is
   intended to remain the same.

 - "mm/swap: skip empty clusters in the swapoff scan" (Youngjun Park):

   Skip empty swap clusters during swapoff instead of walking slots
   which have nothing to release. This avoids pointless work on sparsely
   used swap devices.

 - "mm: trace: decode architecture-specific VMA flags" (Meijing Zhao):

   Teach the VMA trace output to decode architecture-specific flags,
   rather than leaving them as unexplained bits. That should make
   tracing a good deal more useful when debugging unusual mappings.

 - "mm, swap: don't spin on a bad swap entry" (Breno Leitao):

   Stop repeatedly retrying a swap entry which is already known to be
   bad. Make the error path terminate cleanly instead of wasting CPU
   chasing an entry that cannot be used.

 - "mm/page_isolation: fix UBSAN shift-out-of-bounds in
   isolate_single_pageblock" (Qi Xi):

   Fix an out-of-range shift in isolate_single_pageblock() and tighten
   its associated boundary handling. UBSAN found the issue; the result
   should be more robust pageblock isolation.

 - "mm: khugepaged: fix tracepoint UAF" (Vernon Yang):

   Fix a use-after-free in khugepaged tracepoint handling. Make sure the
   information recorded by tracing stays valid for as long as the trace
   event needs it.

 - "mm/damon: fix DAMOS bugs in core, paddr and vaddr" (SJ Park):

   Fix several DAMOS problems across the core and physical- and
   virtual-address backends. The changes close error cases and bring the
   implementations back into agreement.

 - "mm/hugetlb_cgroup: move the per-node usage along with the folio"
   (Hongfu Li):

   Move HugeTLB per-node usage accounting when folios migrate between
   nodes or are reparented to another cgroup. Otherwise numa_stat can
   retain stale charges and even underflow when the folio is freed.

 - "docs/core-api: memory-allocation: add k[mz]alloc_obj() and clarify
   kmalloc" (Mike Rapoport):

   Document the typed k[mz]alloc_obj() allocation helpers and clear up
   some kmalloc guidance. Make it easier for callers to choose the right
   interface.

 - "selftests/mm: Validate selections and scope memfd_secret setup"
   (Tianyi Chen):

   Check selftest selections before running and confine memfd_secret
   setup to the cases that actually need it. Avoid confusing failures
   caused by the test harness itself.

 - "mm/damon: move zero damos quota target_value handling to the core
   layer" (SJ Park):

   Handle a zero DAMOS quota goal target in the core rather than making
   each user of the interface invent its own rule. Keep quota decisions
   consistent across callers.

 - "mm/damon: Introduce a huge page collapsing mechanism using auto
   tuning" (Asier Gutierrez):

   Add an auto-tuned DAMON mechanism for collapsing huge pages. Use
   monitoring feedback to decide when collapse is worthwhile rather than
   forcing one fixed policy onto every workload.

 - "kmemleak: fix stale documentation and raise the verbose default"
   (Breno Leitao):

   Bring the kmemleak documentation up to date and require a third
   confirming scan before verbose kernels print a suspected leak. The
   extra scan helps suppress transient false positives in noisy debug
   builds.

 - "mm/memory: improve insert_pages() error handling" (Avi Weiss):

   Tighten insert_pages() error handling so partial failures are
   reported and cleaned up consistently. The caller should not have to
   guess how far the operation got.

 - "mm/damon: allow NULL or unstarted damon_ctx parameter for
   damon_call()" (SJ Park):

   Make damon_call() handle NULL and not-yet-started contexts safely.
   Simplify the rules for callers and avoid an indefinite wait on an
   invalid state.

 - "mm/damon: introduce pgidle_set probe filter type" (SJ Park):

   Add a pgidle_set DAMON probe filter, giving monitoring users another
   way to select pages by their idle-tracking state. Wire it through the
   filter interfaces and tests.

 - "mm/damon/core: remove unused helper functions" (Cheng-Han Wu):

   Remove DAMON core helpers which no longer have callers. Keep the API
   surface smaller rather than retaining dead code just in case.

 - "mm: stop calling pmd_folio() on special PMDs" (Gregory Price):

   Avoid calling pmd_folio() on special PMD mappings that have no struct
   page. The old assumption could fault in procfs walkers; use the
   normal-folio checks and handle those mappings properly.

 - "mm: remove three unused helpers from mm.h" (Tal Zussman):

   Remove three unused helpers from mm.h. Fewer obsolete interfaces for
   the next person to stumble over.

 - "mm/damon: improvements in efficiency, error handling, documents"
   (Liew Rui Yan):

   Skip needless DAMOS quota work once the quota is full, propagate a
   missing sysfs error and tidy a couple of comments. The ignored error
   could make a monitoring-start request appear successful when it
   wasn't.

 - "docs/mm/damon/design: add explanation of nr_snapshots" (Liew Rui
   Yan):

   Explain DAMON's nr_snapshots accounting in the design documentation
   and straighten out the associated terminology. Make it clearer what
   users should expect from that counter.

 - "selftests/cgroup: fixes for test_zswap on single core VM" (Wilson
   Felipe Pereira):

   Fix two test_zswap failures on single-CPU VMs. Wait for the exiting
   child's cgroup to become unpopulated before reconfiguring it, and
   avoid another test assumption which breaks under constrained
   scheduling.

 - "docs/ksm: fix advisor documentation and comment" (Jinjiang Tu):

   Correct the KSM advisor documentation and a misleading code comment.
   Keep the description aligned with how the advisor actually works.

 - "Fix bugs in HugeTLB allocation when mem_cgroup_charge_hugetlb()
   fails" (Ackerley Tng):

   Fix HugeTLB allocation cleanup when the memcg charge fails. Make sure
   failure exits undo what was allocated rather than leaving stale
   accounting or resources behind.

 - "mm, memcg: fix memory.peak reset clobbering other fds' watermark"
   (Ridong Chen):

   Fix memory.peak reset handling so resetting one file descriptor
   doesn't overwrite the watermark kept for another. Keep those per-open
   measurements independent as intended.

 - "mm: reject zone device folios in more folio walkers" (Gregory
   Price):

   Reject zone-device folios in page walkers that cannot safely handle
   them. Extend the existing checks rather than assuming every folio has
   ordinary system-memory backing.

 - "percpu: remove code with no effect" (Sang-Heon Jeon):

   Remove a few pieces of percpu code which no longer do anything. There
   is no reason to keep maintaining dead paths.

* tag 'mm-stable-2026-10-19-21-33' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (539 commits)
  mm: shmem: assign a lock class to the unused huge shrinklist
  mm: vmscan: put rotation-missed folios at the LRU tail
  mm: kmemleak: scan the struct page array in MAX_SCAN_SIZE batches
  mm: kmemleak: move the struct page scan into a helper
  mm/damon: document that a zero sample_interval is accepted
  mm/damon: fix typos in comments
  mm/damon/sysfs: propagate damon_call() error in turn_damon_on
  mm/damon/core: skip quota score setup when the quota is full
  mm/damon/tests/core-kunit: test the size charged for a filter-trimmed region
  mm/damon/core: charge only the part of a region the filter left
  mm: disallow raw PFN mappings of huge/shared zeropage
  selftests/mm: zap whole PTE tables in the khugepaged race harness
  selftests/mm: add memory-pressure threads to the khugepaged race harness
  selftests/mm: race the collapse of windows with holes
  selftests/mm: add khugepaged race harness
  selftests/mm: check that one khugepaged pass collapses one window
  selftests/mm: run every supported collapse order by default
  selftests/mm: cover a shared-source collapse write race
  selftests/mm: parameterize the mixed-source collapse case by source order
  selftests/mm: add order-parameterized khugepaged collapse cases
  ...
2026-10-23 07:42:11 -10:00
Yuqi Xu
071aa806f0 tpm: reject duplicate PCR banks in tpm2_get_pcr_allocation
The TPM2_CAP_PCRS response is external input. tpm2_get_pcr_allocation()
adds every active selection to allocated_banks, while
tpm_sysfs_add_device() has one group slot per distinct hash algorithm.
Eight duplicate selections can therefore write past chip->groups[].

The TPM protocol does not allow a hash algorithm to appear twice in
this capability response. Treat a duplicate as a broken TPM and return
-EIO so the chip is not enabled, instead of silently dropping the
extra selection.

Assisted-by: LLM
Signed-off-by: Yuqi Xu <xuyuqiabc@gmail.com>
Reviewed-by: Ren Wei <weir@nebusec.ai>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/9d27c4513a3c6fc32f9574ba192cd3bfcb2bac98.1790568982.git.xuyuqiabc@gmail.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:21 +03:00
Li Jun
03f0525735 tpm: use DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr()
Replace the deprecated SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS
and wrap the struct assignment with pm_sleep_ptr(). The old code keeps
a completely empty dev_pm_ops structure -- all callbacks are NULL --
as dead code in the object file when CONFIG_PM_SLEEP=n, because
SET_SYSTEM_SLEEP_PM_OPS() expands to nothing while __maybe_unused on
the struct only silences the warning without removing the struct.
Switching to DEFINE_SIMPLE_DEV_PM_OPS() lets pm_sleep_ptr() eliminate
the callback references at compile time, and wrapping the struct
assignment with pm_sleep_ptr() drops the entire structure when
CONFIG_PM_SLEEP is disabled, instead of retaining an empty one.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20260909082459.796628-1-lijun01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:21 +03:00
Li Jun
fc0ddb3174 char: tpm: Use SIMPLE_DEV_PM_OPS for ibmvtpm power management
Replace the manually defined dev_pm_ops structure with the
SIMPLE_DEV_PM_OPS macro to simplify the power management code.
This macro automatically handles CONFIG_PM_SLEEP configuration,
generating the same suspend/resume callbacks while reducing
boilerplate code.Add the value of 'thaw,freeze,poweroff,restore'.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20260819083547.2703228-1-lijun01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Stefano Radaelli
95ae1ad345 tpm: tis_i2c: Deassert optional reset line before probing
The common TPM Device Tree binding already documents resets and
reset-gpios, but the TIS I2C driver never requests a reset control.
As a result, an I2C TPM held in reset by board wiring remains
inaccessible and the first register access during probe fails.

Request the optional reset control and deassert it before
communicating with the TPM. This keeps existing boards without a reset
line unchanged while allowing platforms using resets or reset-gpios to
release the TPM before probe continues.

Tested on a Variscite DART-MX95 with an ST33KTPM2XI2C TPM using
reset-gpios.

Signed-off-by: Stefano Radaelli <stefano.r@variscite.com>
Link: https://lore.kernel.org/r/20260917124211.136221-1-stefano.r@variscite.com
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Richard Lyu
a32b7973d6 tpm: Remove ineffective wmb() from tpm_pm_resume()
The comment above the wmb() in tpm_pm_resume() states that the barrier
guarantees TPM_CHIP_FLAG_SUSPENDED is written last, so that hwrng does
not activate before the chip has been fully resumed.  It cannot do so:
it is placed after the store that clears the flag, and therefore does
not order the preceding resume work before that store.  It also has
nothing to pair with, as tpm_try_get_ops() contains no matching read
barrier.

Drop the barrier along with the comment rather than leave a no-op
behind.  Should such ordering turn out to be needed, it would require
paired barriers or locking.

Link: https://lore.kernel.org/all/a62fc816-259a-4d28-a265-e425bc17ed50@gmail.com/
Signed-off-by: Richard Lyu <richard.lyu@suse.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20260910024430.40418-1-richard.lyu@suse.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Mario Limonciello
313acd594a tpm: Call cmd_ready/go_idle for each command transmission
Some TPM implementations, particularly fTPM using the CRB interface,
require the TPM to transition through idle and ready states for each
command rather than once per session.

The current implementation calls cmd_ready once during tpm_chip_start()
and go_idle once during tpm_chip_stop(). For fTPM, when multiple commands
are sent without per-command idle transitions, subsequent commands timeout
as the TPM is waiting for the transition.

Fix this by calling cmd_ready before each command and go_idle on all exit
paths in tpm_try_transmit(). For TPM implementations that don't require
per-command transitions, the callbacks return immediately based on the
start method.

Remove the now-redundant per-session calls from tpm_chip_start() and
tpm_chip_stop() along with their helpers.

This resolves timeout errors during TPM initialization on systems where
BIOS has already performed TPM startup.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20260901213723.3017371-1-mario.limonciello@amd.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Pei Xiao
6fc1b05077 tpm: fix zero-length read discarding the pending response
POSIX requires that a read() with a count of zero returns zero and
has no other effects.  tpm_common_read() treats such a call as a
consumed response: it marks the pending response as read and drops
it, so the response can never be retrieved; subsequent reads return
zero and the next write() is allowed to overwrite the response
buffer, silently breaking the command/response pairing of the TPM
character devices.

Return early when the caller passes a zero count, leaving any
pending response untouched for the next read.  A zero-length read
will not report a deferred asynchronous error; POSIX permits read()
to skip error detection for a zero count.

Cc: stable@vger.kernel.org
Fixes: 9488585b21 ("tpm: add support for partial reads")
Assisted-by: GLM-5.3
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Link: https://lore.kernel.org/r/3f15140ab3c26e98b49d6aceaaa826585d56960b.1791015549.git.xiaopei01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Pei Xiao
df0ef27108 tpm: tpm_nsc: stop using the cleanup callback as dev.release
tpm_nsc_remove() is called explicitly from cleanup_nsc() and also
runs as the platform device release callback on the final
platform_device_put(), so the cleanup executes twice on module
exit; the second invocation operates on a chip that has already
been freed by the devm cleanup, and the I/O region is released
twice.

Overwriting the release callback installed by
platform_device_alloc() also keeps platform_device_release() from
running, leaking the platform object allocation.

Leave the default release callback in place; the explicit call in
cleanup_nsc() remains the single cleanup point.

Cc: stable@vger.kernel.org
Fixes: 570302a311 ("[PATCH] tpm: move nsc driver off pci_dev")
Assisted-by: GLM-5.3
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/a6155310e6772f708b47291cc959e02c05b90eb7.1791015549.git.xiaopei01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Pei Xiao
1900449684 tpm: tpm_nsc: fix NULL pointer dereference on init failure
tpm_nsc_remove() is used as the release callback of the hand-created
platform device and dereferences the chip drvdata unconditionally.
If init fails before tpmm_chip_alloc() (e.g. request_region() cannot
claim the ports), the error path drops the last device reference and
the release callback runs with chip == NULL, crashing module init.

Return early when the chip has not been created yet.

Cc: stable@vger.kernel.org
Fixes: afb5abc262 ("tpm: two-phase chip management functions")
Assisted-by: GLM-5.3
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/d5f0b38d6d6c17c01519c879d26448dbae388b0e.1791015549.git.xiaopei01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Alexander Sverdlin
7d4f1cbfe0 tpm: tpm2_probe: propagate transport errors
tpm2_probe() reads the protocol version from the response tag and is
documented to return -errno on failure, but it always returns 0.  A
transport error (tpm_transmit_cmd() < 0) is thus swallowed together with
the intentionally ignored TPM response code, leaving TPM_CHIP_FLAG_TPM2
unset. A transient bus failure on the first command then misdetects a
TPM 2.0 as a 1.2 and the probe fails on the TPM 1.2 path:

  tpm_tis_i2c 0-002e: 1.2 TPM (device-id 0x1C, rev-id 22)
  tpm tpm0: A TPM error (-62) occurred attempting to determine the timeouts

Return the transport error instead; rc >= 0 still means a valid header was
received and the TPM's own response code is still ignored.

Fixes: 94e266ba1f ("tpm: migrate tpm2_probe() to use struct tpm_buf")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lore.kernel.org/r/20261001060114.1582092-1-alexander.sverdlin@siemens.com
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
2026-10-23 00:59:20 +03:00
Linus Torvalds
bf23250845 This update includes the following changes:
API:
 
 - Fix algif_skcipher source SG overrun.
 - Allow hmac(sha512) for non-root users.
 
 Algorithms:
 
 - Add wrapper for zeroing AES key context.
 - Avoid redundant stream initialisations in zstd.
 
 Drivers:
 
 - Remove hisilicon/sec.
 - Handle digest-only authenc requests in atmel.
 - Handle zero-length skcipher requests in mxs-dcp.
 - Lower the default priority of caam/qi2.
 
 Others:
 
 - Optimise key comparison in rhashtable lookup that uses constant parameters.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEn51F/lCuNhUwmDeSxycdCkmxi6cFAmrVtLsACgkQxycdCkmx
 i6cflxAAghMP47yn7CoImtft1TZoEDhj2pdoe0AiIoaynN8SJUFIvikMA6KnOMdM
 dd4O6G4A5wkcMXXedmhxhKHOv9jZdBHFq+YeCvxWkaHlRm20ZSk+CL2/Mdt4ZCVz
 9YibMnl9d/HYyUKJ9+4XU+3rCzEXXf+8mnLc4DdFTXeH2zhw4+ZvpBA9aDxnBI+V
 rZm7+SusnFR9Bh0OWsJlPUfZ1Xzkm+DtFTctiCc9nUUV5z8ykCya3WxCuSb/BTUU
 T6sZTJNJGRPE2n1kRYIsvSgvlGaAv8NLVWX1IGyosdDJrJ5pPgm8tbl6ZR9BqVZT
 o0ysImwyHK8YrDcBWk+SlohFSHDzNTTQMCx9/UEwNmsRaf4M5yYP964ASsqAenQz
 vm3lstFBktEeZe6T/Z1sw9cISDY38v0I2G9fbU/Rz7ZhqLD12U5fzV3PmdBXSG9S
 fXXO6n5N0EfT/NXDwgncBgQLV+ejp/SJbiDDhrSxtLdPFU9BUkPhmEvxJ5pAiB/3
 eOfVWZFOelzpx5FGArWy73MDpoMiX7Cki3fr2BtSY1/gEtQDMKkooH/Mq97cV1f+
 CXjv744YEfGwoD9Dw620bEGRKXg3+ISA6h5+LelyfY6NOWO78kRhY2DvnWGHPV4B
 0Glkj64Zpxp7W3CHVNIriy6DhU3+QuJGhUhXEoRGrnwJAp+kElY=
 =hDmH
 -----END PGP SIGNATURE-----

Merge tag 'v7.4-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto updates from Herbert Xu:
 "API:
   - Fix algif_skcipher source SG overrun
   - Allow hmac(sha512) for non-root users

  Algorithms:
   - Add wrapper for zeroing AES key context
   - Avoid redundant stream initialisations in zstd

  Drivers:
   - Remove hisilicon/sec.
   - Handle digest-only authenc requests in atmel
   - Handle zero-length skcipher requests in mxs-dcp
   - Lower the default priority of caam/qi2

  Others:
   - Optimise key comparison in rhashtable lookup that uses constant
     parameters"

* tag 'v7.4-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (146 commits)
  crypto: atmel-tdes - consolidate error paths in atmel_tdes_dma_init()
  crypto: atmel-tdes - reuse fast in atmel_tdes_crypt_start()
  crypto: atmel-tdes - use separate DMA scatterlists
  MAINTAINERS: delete entry for John Allen
  hwrng: amd - use PMBASE_OFFSET consistently
  hwrng: cctrng - simplify cctrng_probe()
  hwrng: intel - simplify intel_rng_mod_init()
  crypto: qat - fix use of destroyed vf2pf_lock on VF restart
  crypto: qat - initialise state_lock on every path in adf_devmgr_add_dev()
  hwrng: imx-rngc - Use optional clock
  crypto: talitos - init tasklets before requesting IRQs
  crypto: algif_skcipher - rewind rounded output bytes
  crypto: algif_hash - Allow hmac(sha512) for unpriviledged users
  crypto: sa2ul - Remove unused fields
  hwrng: stm32 - use devm_platform_ioremap_resource() in stm32_rng_probe()
  hwrng: stm32 - drop redundant initializations
  hwrng: amd - simplify control flow in amd_rng_mod_init()
  hwrng: stm32 - reuse clock rate in stm32_rng_clock_freq_restrain()
  hwrng: stm32 - use swap() in stm32_rng_probe()
  hwrng: cctrng - drop redundant initializations
  ...
2026-10-22 09:36:46 -10:00
Linus Torvalds
22a78a2543 Merge __{get,put}_user() removal branch
This is long over-due: the __get_user() and __put_user() functions are
entirely historical, and are never the rigth thing to use any more.  And
when mis-used (read: every case) they are not only slower than the right
thing, but also insecure because they don't check the user address
range.

Most of the usage sites have been converted long ago, but various
left-overs remained.  So this started out as a single patch that I wrote
as a "show people how to convert __{get,put}_user() to modern code".

In particular, Thomas last year implemented the very nice new scoped
user access region helpers (see commit e497310b4ffb: "uaccess: Provide
scoped user access regions") that makes the modern interfaces
particularly easy to use and really removes any excuse for the old
horrors.

That small example patch then grew to this, partly using Claude as a
glorified coccinelle script to apply the pattern to other places.

There were a few different reasons for using __put_user() and
__get_user() rather than the alternatives, but the original historical
one was performance: when doing multiple accesses off the same base
pointer, doing a single range check followed by multiple non-checked
accesses used to create smaller and faster code.

The keyword here is "used to".  It hasn't been true for years, because
the range check isn't actually the real cost these days.  The real cost
of user accesses on modern hardware is turning the user accesses on and
off in the first place (on x86, using the STAC/CLAC instructions).

Those sequences get turned into 'scoped_user_read_access() { }' blocks,
see for example that first patch in the series: "signal: use scoped user
access for old-style sigaction".

Another, historical reason for using __get_user() and friends is that
you actually want to do a kernel pointer access, but the pointer might
not be entirely reliable (typically during fault handling), so you want
to have exception handling for the kernel access.

The modern way to do that kind of non-faulting kernel access is using
"get_kernel_nofault()", but some code predates that helper existing at
all, and used __get_user() as a way to just get a memory access with
exception handling.  For that pattern, see for example "alpha: use
get_kernel_nofault() in dik_show_code()"

A third bad reason for using __get_user() and friends was that the
proper get_user() had a "might_fault()" in it, and code that ran in
atomic regions but hadn't disabled page faults would result in a
warning.  That kind of code needs to explicitly disable page faults,
because "atomic region" is not well defined at run-time and can be
invisible (eg a preempt-off region in a non-preemptible kernel).

See "vdpa_sim: disable page faults around vringh_need_notify_iotlb()"
for an example of that pattern, where the local_bh_disable() now also
grows a pagefault_disable(), which makes the normal get_user() no longer
warn about the user access in non-process context, because it can see
that the potential page fault will not cause problems.

And finally, the really nasty reason to use __get_user() and friends:
pointers that can be either kernel pointers or user pointers.  We've
gotten rid of almost all such cases, but a couple remained.  See for
example "x86/sev: Use explicit user-or-kernel accessors for #VC memory
operands".

NOTE! This series removes all __get/put_user() calls from generic code
but only does the final removal of the whole interface on x86.  Other
architectures have not been entirely converted, for a variety of reasons:

 - arm64 makes __{get,put}_user() be exactly the same as
   {get,put}_user() so it's harmless and didn't have the dangers of the
   legacy use cases.

 - any architecture that uses <asm-generic/uaccess.h> will still use
   __{get,put}_user as the underlying helper function name

 - several architectures had some legacy uses that weren't entirely
   trivial and I didn't want to extend this patch series to things that
   I don't know and that don't really matter.

but I did do a couple of the obvious "follows the exact same pattern"
just because it could be done mindlessly and automatically.

Let's see if I broke anything, but we should have done this years ago.

* uaccess-cleanups: (48 commits)
  drm/i915/gem: ignore errors on presumed_offset write-back
  powerpc/align: use get_user_instr() for a user-mode instruction
  powerpc/signal64: use scoped user access in setup_trampoline()
  powerpc/signal64: use get_user() for the single context reads
  powerpc/signal32: use get_user() for the single context reads
  KVM: PPC: Book3S HV: use get_user()/put_user() for the HPT fd
  powerpc/powernv: use get_user()/put_user() in the LPC debugfs files
  s390: use get_user()/put_user() instead of the unchecked variants
  ARM: OABI: use scoped user access in epoll_put_uevent()
  ARM: signal: stop using __put_user() for the signal frame
  ARM: signal: check the FDPIC function descriptor address
  alpha: split the prefetch check in do_page_fault() by mode
  openrisc: use get_kernel_nofault() in show_registers()
  alpha: use get_kernel_nofault() in dik_show_code()
  nios2: use scoped user access for the signal frame
  nios2: check the signal frame address before writing to it
  hexagon: use scoped user access for the signal frame
  alpha: use scoped user access when setting up signal frames
  alpha: use scoped user access in the sigreturn path
  alpha: use scoped user access in osf_sigaction()
  ...
2026-10-21 07:19:30 -10:00
Linus Torvalds
0c5db8acc6 char: nwflash: use get_user() in write_block()
write_block() reads the user buffer one byte at a time with __get_user()
while programming and then verifying the flash, relying on the
access_ok() done in flash_write().  Each __get_user() enables and
disables user access on its own anyway, so the separation saves nothing.

Use get_user().

This is part of getting rid of __get_user() and __put_user() entirely.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-10-20 08:07:28 -10:00
Linus Torvalds
303bff3637 Core features:
- Remove big-endian kernel support: CONFIG_CPU_BIG_ENDIAN has depended
    on BROKEN for a while, so drop the remaining code (BE hypervisor
    object, BPF JIT, assembly/crypto/library routines, endianness helper
    macros, selftests) and force a little-endian build
 
  - Add preemptible this_cpu_*() operations (read/write, RMW, xchg,
    cmpxchg and cmpxchg128) that no longer need to disable preemption
    around the per-CPU address generation and access
 
  - Preparation patches for implementing CONFIG_HOTPLUG_PARALLEL on
    arm64
 
 Memory management:
 
  - Treat faults taken by EFI runtime firmware as kernel faults
 
  - Clear PTE_WRITE for EFI_MEMORY_RO mappings (with hardware dirty state
    management enabled, this is not truly read-only)
 
  - Raise the default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
    configurations (28/26/24 bits for 4K/16K/64K pages)
 
  - Implement clear_page[s]() using memset()
 
  - Enable BBML2 no-abort (a.k.a. BBML3) for the NVIDIA Rigel CPU
 
 Perf and PMU:
 
  - Support for HiSilicon's ITS PMU
 
  - Add support for some new events: INST_SIMD_ALU_VEC for Apple PMUs and
    a cycle counter for the latest version of HiSilicon's MN PMU hardware
 
  - A bunch of fixes to the CXL PMU driver to address pre-existing issues
    from Sashiko
 
  - Fix generation of PERF_RECORD_ITRACE_START records for SPE and ETM
    drivers
 
  - Reduce excessive stack consumption in the Marvell DDR PMU driver
 
  - Minor driver updates and cleanups all over
 
 Arm Confidential Compute Architecture (CCA):
 
  - Add an Arm SMCCC bus for firmware services discovered through SMCCC
    and move the TRNG and CCA guest (TSM provider) drivers onto it,
    removing the dummy CCA platform device and adding a sysfs ABI for
    Realm guests
 
  - Move the Realm Service Interface (RSI) code out of arch/arm64/ into
    drivers/firmware/arm_rmm/
 
  - Add the host side of the Realm Management Interface (RMI): detect,
    configure and activate the RMM, add SRO support and wrappers for the
    Realm RMI commands
 
  - Block hibernation (new arch hook in the PM core) and kexec while the
    RMM is active. To be revisited in the future with proper support for
    deactivation
 
  - Handle Granule Protection Faults (GPFs) taken by the host, caused by
    accesses to memory delegated to the RMM. In a future patch, the
    exception table lookup will be limited to is_kdump_kernel() cases
 
 MPAM (Memory Partitioning And Monitoring):
 
  - Add support for the MPAM firmware-backed (Fb) interface, allowing
    MSC accesses to be mediated by firmware
 
  - Fix a list of theoretical issues with the driver (MSC access error
    propagation, MBWU monitor save/restore and locking, resctrl class
    handling, error interrupt restore, maximum number of PARTIDs)
 
  - Add the mailing list and a missing file to the MAINTAINERS entry
 
  - Document when to set arm64.nompam
 
 Errata and CPU features:
 
  - Add the NXP i.MX8QM/8QP workaround for the Cortex-A53 cache coherency
    issue (ERR050104), using a new ARM64_CPUCAP_SOC_ERRATUM capability
    type for SoC-level errata
 
 Miscellaneous:
 
  - Mask debug exceptions (DAIF) around the hardware breakpoint register
    manipulations when called from generic kernel code
 
  - Don't zero the SVE state buffer when the SVE state is live
 
  - Return -EPERM instead of -EBUSY from the GCS prctl() locking
    failures (matching x86), with the selftest updated. Slight ABI change
    but no software deployment yet
 
  - kselftest: fix unsound MTE fault skipping by introducing MTE-safe
    memory accessors, avoid copying each signal test binary more than
    once
 
  - Update sysreg definitions (fix three enum values and two field names,
    mark architecturally dropped fields as RES0) and remove the TME
    transaction state check from the BRBE driver
 
  - Fix the description of ARM64_HAS_LPA2 and remove a redundant
    ID_AA64MMFR0 define
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAmrRImIACgkQa9axLQDI
 XvG+mw/+Lu/PONW1zxo4M65u3vR2bTBqhx8Xo3MP15ANaNVEb3guiUX0ZGAMVdz7
 NgN5NAQFQ5lwb8V8F5LSPGPlHTZ/KEYbiu2IRqwNvUrr2xU+Bz2AZKGvTfScEokO
 PiNfe84I7pWG+U77eBotZ5TxBQiLRe+8VWetIlPOQK9QUm0PG6Z50vhBBahg5kvJ
 b0nf2K3mSIscQRskykkCfIAwTShJM1NvW4+Ygfz6UjHaTtvPg+wsHPMZunKLJW5F
 tbXjZxcJQPziTl7lsRZuKbBrW7Sm5XRl54Q5Tl5ToXQ/C8h2jKjaNoqyXfV+ETJx
 MnFMQfmSIXuKlPuhZTiZK1viVXJe886iCi0vavMwKIR1zNJBKWLWeFz7cepe/jfq
 PHnZo9dX9dNRS7vzBGVq1aYUe/pn5eVeYrUQjMWCyKF2aLvSLm5n4Tf+XtvDUrkA
 O5EuP7sHL8xY9wCJ+Mw45gX1sQiJRy2jBOBbUvZ2/F6ACgG8dvKS9lhpbIn8IsKU
 rFkwacTcsUCoKCnthOwupRApUU/S2fiyzEoUc/R/gDubmnDET3nLcSsspg/FacqP
 OOq/6ErxAQ3HA5ltK0Siq8/qud9mnpYa0xyoxs7EED3jpX2A3lLf9UZduZ+r/2IP
 k5KI+4yRkYPBqGoFjwO8nMrk8jgvZzAtTMh86EOI4LZkcNEvuzU=
 =YdKt
 -----END PGP SIGNATURE-----

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 updates from Catalin Marinas:
 "Here are the arm64 updates for 7.4.

  The more interesting bits are the removal of big-endian kernel support
  (already marked BROKEN for some time), preemptible this_cpu_*()
  operations and MPAM support for the firmware-backed (Fb) interface.

  CCA (Arm's confidential compute) is slowly trickling in with host RMI
  (Realm Management Interface) support and some refactoring, including a
  dedicated SMCCC bus to advertise firmware services. There are also the
  usual PMU updates for new hardware and a few fixes/cleanups.

  Core features:

   - Remove big-endian kernel support: CONFIG_CPU_BIG_ENDIAN has
     depended on BROKEN for a while, so drop the remaining code (BE
     hypervisor object, BPF JIT, assembly/crypto/library routines,
     endianness helper macros, selftests) and force a little-endian
     build

   - Add preemptible this_cpu_*() operations (read/write, RMW, xchg,
     cmpxchg and cmpxchg128) that no longer need to disable preemption
     around the per-CPU address generation and access

   - Preparation patches for implementing CONFIG_HOTPLUG_PARALLEL on
     arm64

  Memory management:

   - Treat faults taken by EFI runtime firmware as kernel faults

   - Clear PTE_WRITE for EFI_MEMORY_RO mappings (with hardware dirty
     state management enabled, this is not truly read-only)

   - Raise the default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
     configurations (28/26/24 bits for 4K/16K/64K pages)

   - Implement clear_page[s]() using memset()

   - Enable BBML2 no-abort (a.k.a. BBML3) for the NVIDIA Rigel CPU

  Perf and PMU:

   - Support for HiSilicon's ITS PMU

   - Add support for some new events: INST_SIMD_ALU_VEC for Apple PMUs
     and a cycle counter for the latest version of HiSilicon's MN PMU
     hardware

   - A bunch of fixes to the CXL PMU driver to address pre-existing
     issues from Sashiko

   - Fix generation of PERF_RECORD_ITRACE_START records for SPE and ETM
     drivers

   - Reduce excessive stack consumption in the Marvell DDR PMU driver

   - Minor driver updates and cleanups all over

  Arm Confidential Compute Architecture (CCA):

   - Add an Arm SMCCC bus for firmware services discovered through SMCCC
     and move the TRNG and CCA guest (TSM provider) drivers onto it,
     removing the dummy CCA platform device and adding a sysfs ABI for
     Realm guests

   - Move the Realm Service Interface (RSI) code out of arch/arm64/ into
     drivers/firmware/arm_rmm/

   - Add the host side of the Realm Management Interface (RMI): detect,
     configure and activate the RMM, add SRO support and wrappers for
     the Realm RMI commands

   - Block hibernation (new arch hook in the PM core) and kexec while
     the RMM is active. To be revisited in the future with proper
     support for deactivation

   - Handle Granule Protection Faults (GPFs) taken by the host, caused
     by accesses to memory delegated to the RMM. In a future patch, the
     exception table lookup will be limited to is_kdump_kernel() cases

  MPAM (Memory Partitioning And Monitoring):

   - Add support for the MPAM firmware-backed (Fb) interface, allowing
     MSC accesses to be mediated by firmware

   - Fix a list of theoretical issues with the driver (MSC access error
     propagation, MBWU monitor save/restore and locking, resctrl class
     handling, error interrupt restore, maximum number of PARTIDs)

   - Add the mailing list and a missing file to the MAINTAINERS entry

   - Document when to set arm64.nompam

  Errata and CPU features:

   - Add the NXP i.MX8QM/8QP workaround for the Cortex-A53 cache
     coherency issue (ERR050104), using a new ARM64_CPUCAP_SOC_ERRATUM
     capability type for SoC-level errata

  Miscellaneous:

   - Mask debug exceptions (DAIF) around the hardware breakpoint
     register manipulations when called from generic kernel code

   - Don't zero the SVE state buffer when the SVE state is live

   - Return -EPERM instead of -EBUSY from the GCS prctl() locking
     failures (matching x86), with the selftest updated. Slight ABI
     change but no software deployment yet

   - kselftest: fix unsound MTE fault skipping by introducing MTE-safe
     memory accessors, avoid copying each signal test binary more than
     once

   - Update sysreg definitions (fix three enum values and two field
     names, mark architecturally dropped fields as RES0) and remove the
     TME transaction state check from the BRBE driver

   - Fix the description of ARM64_HAS_LPA2 and remove a redundant
     ID_AA64MMFR0 define"

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (144 commits)
  arm64: cpufeature: Enable BBML2 for NVIDIA Rigel
  arm64: cputype: Add NVIDIA Rigel definitions
  arm64: raise default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA
  arm64/debug: mask debug exceptions when called from common code
  kselftest/arm64: signal: copy each test binary only once
  kselftest/arm64: Check for -EPERM not -EBUSY in the locking test
  arm64: gcs: Return -EPERM not -EBUSY for prctl() locking failures
  perf: arm_brbe: Remove the check for TME transaction states
  arm64: sysreg: Mark fields the architecture dropped as RES0
  arm64: sysreg: Fix the names of two misspelt fields
  arm64: sysreg: Fix three incorrect enum values
  arm64: smp: Defer RCU registration during secondary CPU bringup
  arm64: smp: Don't bother printing the I-cache policy for each CPU
  arm64: smp: Defer update of secondary CPU capabilities
  arm64: smp: Tidy up cpuinfo init and cpufeature updates
  arm64: smp: Tidy up smp_prepare_cpus()
  arm64: cpufeature: Store every ID register with its overrides applied
  arm64: cpufeature: Read MPAMIDR_EL1 in __cpuinfo_store_cpu()
  arm64: cpufeature: Add read_cpuid_with_overrides()
  arm64: cpufeature: Check arm64_ftr_regs[] before the first store
  ...
2026-10-20 07:55:19 -10:00
Linus Torvalds
8d1cec6c76 drivers/char/mem: use get_user()/put_user() for /dev/port byte copies
read_port() and write_port() check the whole user buffer with
access_ok() and then move it one byte at a time with __put_user() and
__get_user(), doing an inb() or outb() for each.  Each of those accesses
enables and disables user access on its own, so the up-front check saves
nothing.

Use put_user() and get_user().  The access_ok() stays, because it also
makes a partly invalid buffer fail up front, rather than after some
ports have already been read or written.

This is part of getting rid of __get_user() and __put_user() entirely.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-10-19 19:23:55 -10:00
Thorsten Blum
a298885565 hwrng: amd - use PMBASE_OFFSET consistently
Use PMBASE_OFFSET instead of the hard-coded 0xF0 and add the missing
space to the ioport_map() error message.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-15 20:37:52 +11:00
Thorsten Blum
a7ea3d63e8 hwrng: cctrng - simplify cctrng_probe()
Handle the error directly and drop the goto statement.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-15 20:37:52 +11:00
Thorsten Blum
cc29ce88b1 hwrng: intel - simplify intel_rng_mod_init()
Return errors directly to simplify intel_rng_mod_init().

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-15 20:37:52 +11:00
Jean-Michel Hautbois
9260491bbf hwrng: imx-rngc - Use optional clock
Change devm_clk_get() to devm_clk_get_optional() to support platforms
where the RNG clock is always enabled and not exposed via the clock
framework (such as ColdFire MCF54418).

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-15 20:37:52 +11:00
Eli Billauer
7dc112d608 char: xillybus: Ignore and report unsolicited interrupts
During initialization, the hardware should issue interrupts only in
response to requests from the host. Ignore and log unexpected interrupts,
as these indicate misbehaving hardware, and return IRQ_NONE when the
interrupt appears to be spurious.

In the same spirit, in xilly_quiesce(), assign endpoint->num_channels = 0
before allowing the ISR, in order to expose whether the hardware
incorrectly sends messages related to data channels during shutdown.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-8-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:17 +02:00
Eli Billauer
1ce74f6f22 char: xillybus: Add defensive sanity checks
Add validation checks for values derived from hardware or user input to
prevent incorrect behavior with malformed data.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-7-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:17 +02:00
Eli Billauer
04b47d2005 char: xillybus: Integer arithmetic improvements
Choose unsigned integers instead of signed where natural and required to
ensure defined overflow behavoir.

Simplify an arithmetic expression too.

No functional change is expected, as the relevant variables normally never
reach values where this transition matters.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-6-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:17 +02:00
Eli Billauer
f82830f560 char: xillybus: Use unsigned arithmetic for jiffies differences
Change the type of jiffies-related deadline variables from long to
unsigned long, and remove unnecessary casts when computing time
remaining as deadline - jiffies.

No functional change is expected: although signed overflow is undefined
in the C standard, processors perform the calculation correctly in
practice. Using unsigned arithmetic is nevertheless the proper way to
handle jiffies differences.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-5-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:17 +02:00
Eli Billauer
9db7ade8f8 char: xillybus: Avoid possible bandwidth inefficiency
The host flow controls the payload data flow from the FPGA by sending
OPCODE_SET_CHECKPOINT messages. Fix the condition for sending such a
message, to correctly handle the case where leap < 0.

The previous expression leap > (fifo->size >> 3) was not intended to
evaluate true when leap is negative. However, due to C's integer
promotion rules, leap (of s32 type) is promoted to unsigned int when
compared with the unsigned fifo->size >> 3 expression. As a result,
negative leap values are interpreted as large positive numbers, causing
the condition to evaluate true unintentionally.

Consequently, the device receives correctly formed checkpoint messages
that encourage it to send data, but too frequently. This may cause the
device to send short data chunks, wasting USB bandwidth.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-4-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:16 +02:00
Eli Billauer
ca263d97a8 char: xillybus: Remove duplicate error path code
Remove dedicated code for the error path, which is both redundant and
incorrect: It calls kref_put() before mutex_unlock(&chan->lock). As
kref_put() may result in releasing the memory containing the mutex, this
could lead to UAF.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-3-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:16 +02:00
Eli Billauer
305876de50 char: xillybus: Improve control of execution flow with mutexes
This commit addresses two issues by using mutexes:

(1) Add a mutex to protect the fifo_buf_order global variable. The
    purpose of this variable is avoid repeated failed calls to
    __get_free_pages() for allocating FIFO memory, when the chunk
    size was too big. However, if two drivers are initialized at the
    same time, fifo_init() may run in parallel, and fifo_buf_order
    may be reduced too much. This is a far-fetched scenario, now
    completely prevented by fifo_buf_order_mutex.

(2) setup_channels() acquires process_in_mutex to prevent
    process_bulk_in() from accessing the xillyusb_dev struct. With
    correctly working hardware, process_bulk_in() is never called while
    setup_channels() runs, because the device has no reason to send data
    in that phase. The mutex ensures that process_bulk_in() does not
    touch the members that setup_channels() alters.

    There is no similar protection for data flow in the other direction,
    because during the setup process, the only outbound data is the
    BULK endpoint used for commands, and it remains untouched after its
    initial setup.

Assisted-by: Deepseek:v4-pro Kimi:K2.6 ChatGPT:GPT-5.5 Claude:Sonnet-4.6
Assisted-by: Sashiko-0.2.5:gemini-3.1-pro-preview
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://patch.msgid.link/20261009074557.19996-2-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:31:16 +02:00
Linkai Gong
fe26c195c2 char: scx200_gpio: check cdev_add() return value
cdev_add() can fail. The driver currently ignores the return value and
reports probe success even when the cdev was not registered, leaving a
chrdev region allocated with no working file operations.

Check the return value, emit an error, and unwind the chrdev region and
platform device on failure.

Fixes: 635adb6cd2 ("[PATCH] scx200_gpio: use 1 cdev for N minors, not N for N")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
Link: https://patch.msgid.link/20260803015450.2050900-1-gonglinkai@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-13 16:30:21 +02:00
Jean-Michel Hautbois
cffad6e715 m68k: coldfire: Add RNG support for MCF54418
Add support for the hardware Random Number Generator (RNGB) found on
MCF54418 ColdFire processors with clock enabled at platform
initialization.

The RNGB block is compatible with the imx-rngc driver.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
2026-10-12 13:47:41 +10:00
Lorenzo Stoakes (ARM)
9ee6e52616 mm: move drivers/char/mem.c to mm/char-mem.c
The memory character driver implements several mm-specific features and is
always compiled into the kernel, so move it to mm/ where it belongs.

Among other things the driver implements /dev/mem which provides raw access
to physical memory, and /dev/zero which either allows mapping of a shmem
region (if mapped with MAP_SHARED) or, uniquely, anonymous memory (if
mapped MAP_PRIVATE).

This change lays the foundations to allow MAP_PRIVATE-/dev/zero to be
mapped precisely the same as anonymous memory is mapped as currently it is
an edge case within mm.

Also update a couple of comments that reference 'drivers/char/mem.c' to
reference 'mm/char-mem.c'.

Link: https://lore.kernel.org/20260926-map-private-dev-zero-v3-1-d4781e84ccfc@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Jan Kara <jack@suse.cz>
2026-10-08 22:55:00 -07:00
Thorsten Blum
2fbde5f498 hwrng: stm32 - use devm_platform_ioremap_resource() in stm32_rng_probe()
The resource pointer is unused - use devm_platform_ioremap_resource()
and remove the unnecessary local variable.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:07 +11:00
Thorsten Blum
378bbe625b hwrng: stm32 - drop redundant initializations
The variables are reassigned before their initial values are read - drop
the redundant initializations.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:07 +11:00
Thorsten Blum
aa2c03d372 hwrng: amd - simplify control flow in amd_rng_mod_init()
Replace the goto found statement with a break and check pdev after the
loop. Also consolidate the cleanup paths.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:07 +11:00
Thorsten Blum
70f49f55a1 hwrng: stm32 - reuse clock rate in stm32_rng_clock_freq_restrain()
Reuse clock_rate and avoid calling clk_get_rate() again. Remove the
extra space before the colon while at it.

Signed-off-by: Thorsten Blum <blum@kernel.org>
acked-by: Maxime Méré <maxime.mere@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:07 +11:00
Thorsten Blum
3d68bdcf0d hwrng: stm32 - use swap() in stm32_rng_probe()
Use swap() to simplify stm32_rng_probe().

Signed-off-by: Thorsten Blum <blum@kernel.org>
Acked-by: Maxime Méré <maxime.mere@foss.st.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:07 +11:00
Thorsten Blum
0d69de3887 hwrng: cctrng - drop redundant initializations
The variables are reassigned before their initial values are read - drop
the redundant initializations.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:07 +11:00
Thorsten Blum
7d91d0ae0c hwrng: atmel - use HZ_PER_MHZ in atmel_trng_init()
Combine and inline the rate check to simplify the code. Drop the local
rate variable and use HZ_PER_MHZ instead of the hard-coded frequency.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-08 18:48:06 +11:00
Lorenzo Stoakes (ARM)
d3ed3a4095 drivers/char/mem: mmap readonly MAP_SHARED-/dev/zero correctly
Rather surprisingly, opening /dev/zero read-only then mmap()'ing it
MAP_SHARED gets you true anonymous memory (albeit in a VMA with non-NULL
vma->vm_file).

This is a by-product of MAP_PRIVATE-/dev/zero being how anonymous memory
was mapped in Linux's distant past.

It happens because mmap_zero_prepare() gates on VMA_SHARED_BIT and when
mapping a read-only file MAP_SHARED, do_mmap() clears VMA_SHARED_BIT and
VMA_MAYWRITE_BIT.

The gating is incorrect - the (poorly named) VMA_MAYSHARE_BIT flag exists
explicitly to tell you if something was originally mapped MAP_SHARED.

So the fix is simple - gate on this instead.

This isn't exactly a common use case, but it's unexpected behaviour which
now causes an assert if CONFIG_DEBUG_VM is set.

While this bug has existed since the dawn of time for linux (or at least
since 2.6.12), it hasn't caused issues in the past, so while it's
incorrect behaviour, it doesn't seem necessary to backport that far.

The mapping is now accounted at mmap time and can fail with -ENOMEM under
strict overcommit, and read faults allocate folios.  However this is
normal behaviour for a read-only shmem mapping.

Commit 93c0c8dc87 ("mm/rmap: use anon pgoff to track MAP_PRIVATE
file-backed anon folios") is the first patch at which the debug assert
fires, so target that instead.

Link: https://lore.kernel.org/20260924-fix-dev-zero-readonly-shared-v1-1-153c2111e323@kernel.org
Fixes: 93c0c8dc87 ("mm/rmap: use anon pgoff to track MAP_PRIVATE file-backed anon folios")
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: <syzbot+c181d3198e98f8aef8b9@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/linux-mm/6ab4ae75.80e1c6cc.1e8e5f.000d.GAE@google.com/
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lance Yang <lance.yang@linux.dev>
2026-10-06 16:44:18 -07:00
Greg Kroah-Hartman
d47322a612 Merge 7.3-rc6 into char-misc-next
This resolves a number of merge conflicts between the branches, and we
pick up the fixes in 7.3-rc6 that we need for testing.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-10-05 09:34:50 +02:00
Thorsten Blum
4c3ca7c8c1 hwrng: intel - return -ENOMEM when ioremap() fails
intel_init_hw_struct() incorrectly returns -EBUSY when ioremap() fails.
Return -ENOMEM instead.

Fixes: c24c95a085 ("[PATCH] fix Intel RNG detection")
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:57:22 +10:00
Thorsten Blum
98807de9ac hwrng: virtio - use snprintf() in probe_common()
While the current code works correctly, replace the unbounded sprintf()
with the safer snprintf() to follow secure coding best practices.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:44 +10:00
Thorsten Blum
468dd85acf hwrng: virtio - use min() in copy_data()
Use the simpler min() macro since all values are unsigned and
compatible. The subtraction avail - vi->data_idx is also guaranteed to
be positive by the preceding check.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:44 +10:00
Thorsten Blum
7e7be88151 hwrng: core - reject unknown RNG names
In rng_current_store(), err is 0 after successfully locking rng_mutex,
and if the requested RNG name cannot be found, the function reports
success even though the current RNG was not changed.

Set err = -ENODEV before searching the RNG list to reject unknown names.

Fixes: 142a27f0a7 ("hwrng: core - Reset user selected rng by writing "" to rng_current")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:44 +10:00
Thorsten Blum
7e63867988 hwrng: ba431 - fix reported byte count
Use the size of the buffer element instead of the pointer size to report
the number of bytes read. Since data is a u32 pointer and sizeof(data)
is 8 bytes on 64-bit systems, using the pointer size reports twice the
number of bytes actually read.

Fixes: 0289e9be5d ("hwrng: ba431 - add support for BA431 hwrng")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:44 +10:00
Thorsten Blum
e7f5ce911e hwrng: amd - report partial reads in non-blocking mode
amd_rng_read() returns 0 if no more data is available, even if some data
was already copied to the output buffer. Return the number of copied
bytes instead.

Fixes: 85962d2248 ("hwrng: amd - Convert to new hwrng read() API")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:44 +10:00
Thorsten Blum
10016246d5 hwrng: intel - declare warning string as const
The warning string is not modified and only used during initialization.
Declare it as const, replace __initdata with __initconst, and indent the
string.

Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:44 +10:00
Thorsten Blum
a0590c556c hwrng: intel - return -ENOMEM when kmalloc_obj() fails
intel_rng_mod_init() incorrectly returns -ENODEV when kmalloc_obj()
fails. Return -ENOMEM instead.

Fixes: ee527cd3a2 ("Use stop_machine_run in the Intel RNG driver")
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2026-10-02 18:12:43 +10:00