Commit Graph

9081 Commits

Author SHA1 Message Date
Linus Torvalds
8ebbaf8835 block-7.4-20261029
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmrjrZ0QHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpl3xEACV0gok/rxtzKB/z2gedIdA1NjY488cNdH3
 UP+YpoTNm4GE/A9bfmTLWjGaQlxmDSdlM8cmQzAKTjHNiGNFK/Pv+fqWzaz38Aet
 tUrxby2748CC3oin4BVxdTLqgSg35Yaw2S/zM/Zsxt3eMHtOdWZZYo8FKkvdf7fp
 DR166vphOGQFu598Allrd4OTXj+TLd6EFlZ7WSN7fq2a8193XuIvfH5HRkDEUbVB
 GA1wlltke/zildACho1MldBDkQYeGGGVk/J/1V5P8sB7TRrzyiRbO8RyfvwSR6OH
 ChNeVXA/iLjwJA9HVX7+q+VnVQRK/EgIVZZoum+BG9WO9ZcUaelxgF3ZIdYc0Pj0
 MDwg6iL4oWZKAqdb1jCYpjOqT3avp+oSQSD9sGpnzSmta2sMtQyulo00UGMBDuBP
 xx8zzeggbuJymFXrCTAZ7Ek1EUNZh3qcWgdUOhxHV+R0s9ovyZszOdGV4dLNm0wX
 aBO375d4O9FutZRzUA5vxEHbBue+S3maPkW2txn4WlnJNGRDIN/GyKoY6c5oyogy
 ApYQ2Gqlbvf7VOPiYVADhycVNUzcolf8EBOXu8zFvMTA8aXLwXalrIaEurnhpE51
 EQaPIZFXH4/dj6noHpgvYaAGFAFXpSSSXVIkG8a0CuhkDjrf6vU+dbt4PVhWP3xT
 BSFU97FGbw==
 =i457
 -----END PGP SIGNATURE-----

Merge tag 'block-7.4-20261029' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull more block updates from Jens Axboe:
 "Bigger than usual for an end-of-merge-window pull request, main reason
  being that the MD side I had missed a pull on, and both NVMe and block
  got a good pile of LLM driven fixes where some of them may as well
  just go in now rather than wait a full cycle. This contains:

   - NVMe fixes via Keith:
      - nvme-tcp fallout from the parallel queue allocation: initialize
        pf_cache_lock and the header digest before requests are set up,
        and don't dereference a NULL queue->ctrl on reconnect
      - nvme-fabrics queue mapping fixes: reset io_queues on reconnect,
        limit each queue type to the online CPUs, and clear a poll map
        with no poll queues
      - nvme-tcp io_work priority inversion with send_mutex held
        (Seiji), error recovery on read_sock failure and skipping TLS
        control records while waiting for the ICResp (Martin B), TLS
        handshake timeout validation, and an address attribute race
      - nvme-rdma NULL metadata_sgl dereference with T10-PI
      - nvme-pci early boot hang with the quirks parameter
      - nvme-multipath ANA log bounds underflow, and an nvme-fc
        discovery reference leak
      - nvmet hardening: rdma inline SGL out-of-bounds write and short
        connect requests, fc use-after-free in LS create connection and
        teardown on admin queue failure, pci-epf transport error
        reporting and SGL length checks, zns NUMD wrap, fc stale read
        data, auth state and status fixes, ports list and qid_max
        locking, rdma double puts and irq-safe locking, and a double
        free on metadata SGL allocation failure
      - nvmet fixes from Josef: big discard length truncation, NULL
        derefs for PCI endpoint targets and debugfs host_traddr, stop
        listening when a tcp port is removed, and don't BUG() in
        nvme-loop when a scan runs beside a reset

   - MD fixes via Yu Kuai:
      - raid5 validation: reject too few disks, invalid reshape disks, a
        per-device size below one chunk, and an inconsistent reshape
        state from the superblock instead of BUG(), plus journal payload
        size checks
      - raid5 error path and lifetime fixes: extra_page leak and NULL
        derefs in free_conf/setup_conf, draining released_stripes before
        destroying the cache, RCU for the big_stripe_tree lookup, and
        per-array io_unit slab names
      - md core: reject v0.90 arrays with too many devices, validate
        bblog_size, take reconfig_mutex when enabling PPL, fix the
        mddev->private NULL deref when stopping an array under IO, and
        don't hand out the array before mddev->kobj is added
      - raid10 missing barrier wakeup, raid0 device count validation, a
        bogus mddev_unlock() in lbs_store(), and shared helpers

   - blk-mq fixes from Josef:
      - don't trust the bio cookie in blk_mq_poll()
      - keep tag sharing fair after a queue update
      - don't bring back flags of a completed request from the timeout
        handler
      - honor a restarted timer
      - initialize the dma state for P2P
      - quiesce a queue joining a quiesced tag set
      - set up and exit hctxs under tag_list_lock
      - free the tag bitmaps in the SRCU callback

   - blk-cgroup and friends from Josef:
      - keep the old blkg while reassociating a bio
      - free struct ioc after a grace period
      - don't truncate v1 iops limits
      - fix root io.stat on 32-bit
      - don't free a blkg with its punt work queued
      - flush iolatency enable_work after going offline
      - pass dead group I/O counts on and make reset_stats reset them
      - don't enter reclaim under rq_qos_mutex

   - Other core fixes from Josef:
      - a disk use-after-free in sync_bdevs()
      - don't losing the status of a failed flush request
      - 64-bit sector math for mac partitions
      - apply the segment size to the integrity buffer

   - blk-iocost: abort a weight transfer on invalid donation weights,
     and publish hweights as one atomic value

   - Fix a NULL deref and use-after-free in __blk_crypto_evict_key(),
     reachable via dm-inlinecrypt

   - Fix recursive i_rwsem locking in blkdev_write_iter(), from two
     fixes for the same race landing in the window

   - Advance the iterator after copy-in for SG_DXFER_TO_FROM_DEV, fixing
     an infinite loop in blk_rq_map_user_iov()

   - Check the open mode for LOOP_SET_STATUS in the compat ioctl

   - rnbd-srv use-after-free and kobject fixes

   - drbd timer and req_lock fixes

   - zloop cleanups and error path fixes

   - cdrom header and kernel-doc cleanups"

* tag 'block-7.4-20261029' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (109 commits)
  blk-crypto: fix NULL deref and UAF in __blk_crypto_evict_key()
  zloop: check that the zone backing file support ->{read,write}_iter
  zloop: fput file after failed zone init
  zloop: share more code for opening a zone backing file
  zloop: remove a duplicate call to zloop_get_block_size
  block: fix kernel-doc warnings in blk-map.c and blk-mq-dma.c
  blk-iocost: publish hweights as one atomic value
  blk-iocost: abort weight transfer on invalid donation weights
  rnbd-srv: publish the sess_dev at the end of OPEN
  rnbd-srv: fix use-after-free on two CLOSE messages
  block/rnbd-srv: drop the sess_dev kobject unlocked
  block/rnbd-srv: don't free the device on a sysfs error
  drbd: take req_lock to skip the initial sync as peer
  drbd: stop the start_resync timer of a dying device
  block: apply the segment size to the integrity buffer
  blk-mq: free the bitmaps of tags in the SRCU callback
  block: partitions/mac: compute the sectors in 64 bits
  blk-mq: set up a queue under tag_list_lock
  blk-mq: exit the hctxs of a queue under tag_list_lock
  blk-mq: quiesce a queue that joins a quiesced tag set
  ...
2026-10-30 06:33:23 -10:00
Christoph Hellwig
0c10f8a1a7 zloop: check that the zone backing file support ->{read,write}_iter
I/O to backing files requires support for iter based read/write, so check
for that upfront instead of dereferencing a NULL pointer later.

Fixes: eb0570c7df ("block: new zoned loop block device driver")
Reported-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261029150353.2503201-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 09:29:20 -06:00
Christoph Hellwig
134ffb0755 zloop: fput file after failed zone init
Clean up after failure in zloop_init_zone, as the caller only cleans up
the zones before the current one.

Fixes: eb0570c7df ("block: new zoned loop block device driver")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261029150353.2503201-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 09:29:19 -06:00
Christoph Hellwig
5e9929e2f0 zloop: share more code for opening a zone backing file
Use a common path for opening and querying the block size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261029150353.2503201-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 09:29:19 -06:00
Christoph Hellwig
0835f49095 zloop: remove a duplicate call to zloop_get_block_size
The sequential zone path has two calls to zloop_get_block_size, one
conditional on not having a block size, and one unconditionally.

Remove the latter as the block size only needs to be queried once.

Fixes: eb0570c7df ("block: new zoned loop block device driver")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20261029150353.2503201-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 09:29:19 -06:00
Chris Mason
08ebf69c78 rnbd-srv: publish the sess_dev at the end of OPEN
rnbd_sess_dev_alloc() stores the empty sess_dev in the XArray as its
first step. An IO message with the new ID from another connection can
find it before bdev_file is set, or hold a reference while a failing
OPEN frees it after a mere RCU grace period. Both are reachable from any
host that can open a device.

Reserve the ID with a NULL entry and store the sess_dev once nothing can
fail anymore. The error path still erases the ID, and no longer needs
synchronize_rcu().

Fixes: 2de6c8de19 ("block/rnbd: server: main functionality")
Cc: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
Cc: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Chris Mason <mason@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-41-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 07:23:20 -06:00
Chris Mason
4912dab88b rnbd-srv: fix use-after-free on two CLOSE messages
process_msg_close() looks the sess_dev up with a kref, drops it right
away, and only then takes the session mutex for the teardown. A session
has several connections handled by different workers, so two CLOSE
messages for the same ID both finish the lookup before either one tears
the sess_dev down, and the second one works on freed memory. Any host
that can open a device on the server can do that.

Take the mutex first and look the ID up with xa_load() under it. The
second CLOSE then finds nothing.

Fixes: 2de6c8de19 ("block/rnbd: server: main functionality")
Cc: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
Cc: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Chris Mason <mason@kernel.org>
Link: https://patch.msgid.link/20261028164415.1262013-40-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 07:23:20 -06:00
Josef Bacik
81941915d5 block/rnbd-srv: drop the sess_dev kobject unlocked
rnbd_srv_create_dev_session_sysfs() drops the kobject reference when it
fails. The release function is rnbd_destroy_sess_dev(), which takes
srv_dev->lock, and the caller holds that lock: the worker deadlocks on
itself. A client opening one device as "ram0" and "./ram0" gets there
through -EEXIST from kobject_add().

Have process_msg_open() drop the reference after releasing the lock, and
leave the rest of the cleanup to the release function.

Fixes: 8cee532f46 ("block/rnbd: server: sysfs interface functions")
Fixes: d3a95ccaaf ("block/rnbd: call kobject_put in the failure path")
Cc: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
Cc: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261028164415.1262013-18-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 07:23:19 -06:00
Josef Bacik
d9667ade40 block/rnbd-srv: don't free the device on a sysfs error
rnbd_srv_create_dev_sysfs() drops the only kobject reference on its
error paths, and the release function frees the rnbd_srv_dev.
process_msg_open() keeps using it and ends in destroy_device() with a
list_del() and a second kfree(). This doesn't need memory pressure: a
client opening a device while its last mapping goes away gets -EEXIST
from kobject_add() against the old directory.

Only undo kobject_add() on failure and leave the reference to
destroy_device(). Initialise the kobject once, the next open retries.

Fixes: 8cee532f46 ("block/rnbd: server: sysfs interface functions")
Fixes: d3a95ccaaf ("block/rnbd: call kobject_put in the failure path")
Cc: "Md. Haris Iqbal" <haris.iqbal@ionos.com>
Cc: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261028164415.1262013-17-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 07:23:19 -06:00
Josef Bacik
bf7fff620c drbd: take req_lock to skip the initial sync as peer
_drbd_set_state() must be called with req_lock held. drbd_adm_new_c_uuid()
does, receive_uuids() on the peer doesn't, so a concurrent state change
gets lost: the device is Secondary again, or its failed disk UpToDate,
while the work for the lost change is already queued.

Fixes: b411b3637f ("The DRBD driver")
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261028164415.1262013-15-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 07:23:19 -06:00
Josef Bacik
a439d3fe3e drbd: stop the start_resync timer of a dying device
start_resync_timer gets armed for up to a second and nothing ever
deletes it, so drbd_destroy_device() can free the device with the timer
pending. Shut it down where request_timer is shut down.

Fixes: 370a43e798 ("drbd: Work on the Ahead -> SyncSource transition")
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261028164415.1262013-13-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-29 07:23:19 -06:00
Linus Torvalds
8a36f53fd5 mm.git review status for linus..mm-stable
Everything:
 
 Total patches:       213
 Fixes: tags:         69
 cc:stable patches:   43
 Reviews/patch:       2.04
 Reviewed rate:       86%
 
 Excluding DAMON:
 
 Total patches:       192
 Fixes: tags:         63
 cc:stable patches:   39
 Reviews/patch:       2.18
 Reviewed rate:       89%
 
 Excluding DAMON and selftests:
 
 Total patches:       182
 Fixes: tags:         57
 cc:stable patches:   39
 Reviews/patch:       2.23
 Reviewed rate:       89%
 
 Summary of series in this merge:
 
 - "mm: make VMA flag semantics explicit, eliminate VM_SPECIAL"
   (Lorenzo Stoakes (ARM)):
 
   Replace VM_SPECIAL with helpers describing mapping ownership and
   behavior.  Enforce the mmap flag rules and convert affected drivers,
   removing ambiguous tests shared by driver mappings and ordinary memory.
 
 - "support kselftest on nommu platform" (Hajime Tazaki):
 
   Add opt-in mmap and mremap tests for NOMMU systems.  Teach the runner to
   avoid its fork-dependent timeout command and document the build and
   runtime requirements.
 
 - "mm/collapse: separate a collapse from its callers"
   (Kiryl Shutsemau (Meta)):
 
   Separate huge-page collapse from caller policy.  Replace khugepaged
   identity checks with explicit permissions, and separate scanning from
   collapse with the mmap_lock drop in one place.
 
 - "mm: implement and use vma_has_anon_rmap(), silence KCSAN"
   (Lorenzo Stoakes (ARM)):
 
   Provide a common helper for testing whether a VMA has anonymous reverse
   mappings.  Document the locking rules, annotate intentional concurrent
   reads for KCSAN, and convert the core MM callers.
 
 - "mm/sparse: remove SECTION_MARKED_PRESENT and further cleanups"
   (David Hildenbrand (Arm)):
 
   Remove SECTION_MARKED_PRESENT in favor of the early-section flag.
   Simplify sparse memory initialization, section metadata handling and
   related PFN validity checks.
 
 - "sh: remove NUMA and SPARSEMEM support" (Mike Rapoport (Microsoft)):
 
   Remove SuperH NUMA and SPARSEMEM support.  The extra memory banks have
   been unusable since the NO_BOOTMEM conversion, leaving only the code and
   data overhead.
 
 - "mm: Unify device DAX and HugeTLB vmemmap population paths"
   (Muchun Song):
 
   Unify the generic device DAX and HugeTLB vmemmap population paths and
   shared tail-page handling.  Remove the duplicate DAX machinery while
   retaining the powerpc radix implementation.
 
 - "kselftest: mm: fix some failure of split_huge_page_test" (Yeoreum Yun):
 
   Fix huge-page split tests racing with khugepaged recollapse.  Use pagemap
   and page flags instead of VMA-boundary assumptions which fail when glibc
   has already enabled THP.
 
 - "memcg: move memcgid refcount to objcg to unpin dying memcgs"
   (Bingfang Guo):
 
   Let dying memcgs be freed while swapped-out shmem still holds their IDs.
   Move ID references to reparentable objcgs, with the necessary swap
   accounting and RCU lifetime changes.
 
 - "mm/truncate: fix data loss when truncating straddling large folios"
   (Zhang Yi):
 
   Preserve out-of-range data when truncating straddling large folios.  Fix
   a lookup race and split-failure handling, and handle minimum folio orders
   for the forthcoming ext4 iomap buffered I/O path.
 
 - "mm/damon: introduce damos quota goal target metric complement flag"
   (SJ Park):
 
   Let DAMOS quota goals use a metric's complement, so utilization can also
   express free-memory goals without adding separate metrics.  Add the sysfs
   interface, documentation and tests.
 
 - "arm64/mm: Standardize printing for pgtable entries" (Anshuman Khandual):
 
   Use the generic formatter for arm64 page-table entries, ready for future
   wider entries.  Move the safe-PTE-update check out of the header to avoid
   an include cycle.
 
 - "mm: kmsan: fix iounmap metadata teardown" (Dima Koziuk):
 
   Fix KMSAN metadata leaks on iounmap and failed ioremap allocations.  Free
   backing pages before removing their mappings, and share the teardown with
   partial-allocation cleanup.
 
 - "mm/damon/core: preserve quota state when constructing schemes"
   (Karl Mehltretter):
 
   Preserve running DAMOS quota state while validating parameter updates.
   Even rejected updates could reset accounting and exceed the quota window;
   add tests for both accepted and rejected updates.
 
 - "mm/vmalloc: fix vmalloc_dump_obj VA lookup" (Ye Liu):
 
   Fix vmalloc_dump_obj() lookups for last-page addresses and allocations
   spanning vmap zones.  These allocations were being missed in diagnostic
   output.
 
 - "mm: various (urgent?) fixes" (David Hildenbrand (Arm)):
 
   Fix mmap charge leaks and hugetlb use-after-free, wrong-address
   unmapping, stuck locks and endless faults.  Also preserve reservations on
   failed mremap and handle stale userfaultfd bits.
 
 - "maple_tree: fix maple_range_64 crashes in RCU mode" (Dimitris Charisis):
 
   Fix pointer and metadata confusion during RCU destruction of
   maple_range_64 nodes, avoiding double frees and invalid accesses.  Add a
   regression test; no in-tree user currently uses this combination.
 
 - "mm: fix hugetlb NR_HUGETLB accounting on folio migration" (Hongfu Li):
 
   Fix hugetlb migration and preallocation accounting so /proc/vmstat
   retains the correct count and memory.numa_stat follows the folio to its
   new node.
 
 - "mm/damon: fix a minor bug, clean code, and add a test" (SJ Park):
 
   Fix 32-bit DAMON age overflow which made old regions look young.  Share
   hugetlb folio acquisition code and add a regression test for the
   previously fixed last-region skipping bug.
 
 - "mm/damon/core: cleanup code, reduce stack usage, and add kunit"
   (SJ Park):
 
   Reduce kdamond stack usage and remove unused enums.  Add deterministic
   PSI quota-goal tests which do not depend on the machine's current memory
   pressure.
 
 - "mm/damon: fix the temporal goal tuner's size quota conversion"
   (Donggeun Yoo):
 
   Bound the temporal tuner's quota conversion to prevent overflow and zero
   effective quotas, which could stop schemes making progress.  Add boundary
   tests.
 
 - "Don't use GFP_DMA when calling dma_alloc_coherent" (Baoquan He):
 
   Remove redundant GFP_DMA flags from coherent DMA allocation calls.  The
   DMA API already selects the zone from device limits and ignores the
   caller's flag.
 
 - "kselftest: mm: fix intermittent failure khugepaged test" (Yeoreum Yun):
 
   Propagate child-process failures in the khugepaged tests and prevent
   background collapse from racing their checks.  This removes false passes
   and intermittent failures.
 
 - "MAINTAINERS: cover all hugetlb headers under HUGETLB SUBSYSTEM"
   (Enze Li):
 
   Cover all hugetlb headers in MAINTAINERS so get_maintainer.pl finds the
   right maintainers.  Also label the closing hugetlb_cgroup.h include
   guard.
 
 Summary of the 65 singletons in this merge:
 
 The singletons include a few worthwhile performance fixes. Avoiding
 unnecessary reverse-map tree updates gave a reported 15.9% improvement
 in UnixBench's execl test on a 192-core x86 system. A reclaim retry fix
 stops defrag_mode from spinning under memory.low protection; a reported
 file-creation stress test ran 5.7 times faster, with far less memory
 pressure. Narrower hugetlb invalidations also spare KVM guests needless
 refaults: the reported Redis-in-VM P99 QPS penalty while punching holes
 fell from 7.09% to 1.45%.
 
 Several fixes prevent lost data or corrupted memory. Lazyfree huge-page
 races with mremap()/munmap() could lose data or access freed memory, and
 MADV_COLD could lose a concurrent write's dirty bit. Another fix
 prevents stale migration entries from outliving large folios. On
 filesystems with blocks smaller than a page, extending a file by 4 GiB
 or more could expose bytes written past the old EOF through mmap instead
 of zeroes. That is fixed, along with use-after-free races in
 PAGEMAP_SCAN during process exit and in memory-cgroup accounting on
 PREEMPT_RT kernels.
 
 Other fixes stop UFFDIO_MOVE spinning forever on pinned large folios,
 which could wedge other memory operations, and stop mremap() leaking
 commit charges until allocations fail under strict overcommit. A further
 fix keeps userfaultfd tracking intact on neighboring mappings. NUMA
 binding no longer prevents long-term pins when the chosen node has only
 movable memory, fixing QEMU/VFIO startup and io_uring buffer
 registration failures. MGLRU also gets a fix for early-boot crashes with
 memory cgroups disabled at boot, notably in small crash kernels.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCat66sAAKCRDdBJ7gKXxA
 jrQrAP99kgSXRdlmRZbHeRBHQ6KvI4XnLvQ78MDIzZ3zmBaOugEA5jiIsK2/snFD
 3VaV0oipVZpuwJkVJE6zFkh0tcHgTAo=
 =DHrN
 -----END PGP SIGNATURE-----

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

Pull more MM updates from Andrew Morton:

 - "mm: make VMA flag semantics explicit, eliminate VM_SPECIAL" (Lorenzo
   Stoakes):

   Replace VM_SPECIAL with helpers describing mapping ownership and
   behavior. Enforce the mmap flag rules and convert affected drivers,
   removing ambiguous tests shared by driver mappings and ordinary
   memory.

 - "support kselftest on nommu platform" (Hajime Tazaki):

   Add opt-in mmap and mremap tests for NOMMU systems. Teach the runner
   to avoid its fork-dependent timeout command and document the build
   and runtime requirements.

 - "mm/collapse: separate a collapse from its callers" (Kiryl
   Shutsemau):

   Separate huge-page collapse from caller policy. Replace khugepaged
   identity checks with explicit permissions, and separate scanning from
   collapse with the mmap_lock drop in one place.

 - "mm: implement and use vma_has_anon_rmap(), silence KCSAN" (Lorenzo
   Stoakes):

   Provide a common helper for testing whether a VMA has anonymous
   reverse mappings. Document the locking rules, annotate intentional
   concurrent reads for KCSAN, and convert the core MM callers.

 - "mm/sparse: remove SECTION_MARKED_PRESENT and further cleanups"
   (David Hildenbrand):

   Remove SECTION_MARKED_PRESENT in favor of the early-section flag.
   Simplify sparse memory initialization, section metadata handling and
   related PFN validity checks.

 - "sh: remove NUMA and SPARSEMEM support" (Mike Rapoport):

   Remove SuperH NUMA and SPARSEMEM support. The extra memory banks have
   been unusable since the NO_BOOTMEM conversion, leaving only the code
   and data overhead.

 - "mm: Unify device DAX and HugeTLB vmemmap population paths" (Muchun
   Song):

   Unify the generic device DAX and HugeTLB vmemmap population paths and
   shared tail-page handling. Remove the duplicate DAX machinery while
   retaining the powerpc radix implementation.

 - "kselftest: mm: fix some failure of split_huge_page_test" (Yeoreum
   Yun):

   Fix huge-page split tests racing with khugepaged recollapse. Use
   pagemap and page flags instead of VMA-boundary assumptions which fail
   when glibc has already enabled THP.

 - "memcg: move memcgid refcount to objcg to unpin dying memcgs"
   (Bingfang Guo):

   Let dying memcgs be freed while swapped-out shmem still holds their
   IDs. Move ID references to reparentable objcgs, with the necessary
   swap accounting and RCU lifetime changes.

 - "mm/truncate: fix data loss when truncating straddling large folios"
   (Zhang Yi):

   Preserve out-of-range data when truncating straddling large folios.
   Fix a lookup race and split-failure handling, and handle minimum
   folio orders for the forthcoming ext4 iomap buffered I/O path.

 - "mm/damon: introduce damos quota goal target metric complement flag"
   (SJ Park):

   Let DAMOS quota goals use a metric's complement, so utilization can
   also express free-memory goals without adding separate metrics. Add
   the sysfs interface, documentation and tests.

 - "arm64/mm: Standardize printing for pgtable entries" (Anshuman
   Khandual):

   Use the generic formatter for arm64 page-table entries, ready for
   future wider entries. Move the safe-PTE-update check out of the
   header to avoid an include cycle.

 - "mm: kmsan: fix iounmap metadata teardown" (Dima Koziuk):

   Fix KMSAN metadata leaks on iounmap and failed ioremap allocations.
   Free backing pages before removing their mappings, and share the
   teardown with partial-allocation cleanup.

 - "mm/damon/core: preserve quota state when constructing schemes" (Karl
   Mehltretter):

   Preserve running DAMOS quota state while validating parameter
   updates. Even rejected updates could reset accounting and exceed the
   quota window; add tests for both accepted and rejected updates.

 - "mm/vmalloc: fix vmalloc_dump_obj VA lookup" (Ye Liu):

   Fix vmalloc_dump_obj() lookups for last-page addresses and
   allocations spanning vmap zones. These allocations were being missed
   in diagnostic output.

 - "mm: various (urgent?) fixes" (David Hildenbrand):

   Fix mmap charge leaks and hugetlb use-after-free, wrong-address
   unmapping, stuck locks and endless faults. Also preserve reservations
   on failed mremap and handle stale userfaultfd bits.

 - "maple_tree: fix maple_range_64 crashes in RCU mode" (Dimitris
   Charisis):

   Fix pointer and metadata confusion during RCU destruction of
   maple_range_64 nodes, avoiding double frees and invalid accesses. Add
   a regression test; no in-tree user currently uses this combination.

 - "mm: fix hugetlb NR_HUGETLB accounting on folio migration" (Hongfu
   Li):

   Fix hugetlb migration and preallocation accounting so /proc/vmstat
   retains the correct count and memory.numa_stat follows the folio to
   its new node.

 - "mm/damon: fix a minor bug, clean code, and add a test" (SJ Park):

   Fix 32-bit DAMON age overflow which made old regions look young.
   Share hugetlb folio acquisition code and add a regression test for
   the previously fixed last-region skipping bug.

 - "mm/damon/core: cleanup code, reduce stack usage, and add kunit" (SJ
   Park):

   Reduce kdamond stack usage and remove unused enums. Add deterministic
   PSI quota-goal tests which do not depend on the machine's current
   memory pressure.

 - "mm/damon: fix the temporal goal tuner's size quota conversion"
   (Donggeun Yoo):

   Bound the temporal tuner's quota conversion to prevent overflow and
   zero effective quotas, which could stop schemes making progress. Add
   boundary tests.

 - "Don't use GFP_DMA when calling dma_alloc_coherent" (Baoquan He):

   Remove redundant GFP_DMA flags from coherent DMA allocation calls.
   The DMA API already selects the zone from device limits and ignores
   the caller's flag.

 - "kselftest: mm: fix intermittent failure khugepaged test" (Yeoreum
   Yun):

   Propagate child-process failures in the khugepaged tests and prevent
   background collapse from racing their checks. This removes false
   passes and intermittent failures.

 - "MAINTAINERS: cover all hugetlb headers under HUGETLB SUBSYSTEM"
   (Enze Li):

   Cover all hugetlb headers in MAINTAINERS so get_maintainer.pl finds
   the right maintainers. Also label the closing hugetlb_cgroup.h
   include guard.

Summary of the 65 singletons in this merge:

  The singletons include a few worthwhile performance fixes. Avoiding
  unnecessary reverse-map tree updates gave a reported 15.9% improvement
  in UnixBench's execl test on a 192-core x86 system. A reclaim retry
  fix stops defrag_mode from spinning under memory.low protection; a
  reported file-creation stress test ran 5.7 times faster, with far less
  memory pressure. Narrower hugetlb invalidations also spare KVM guests
  needless refaults: the reported Redis-in-VM P99 QPS penalty while
  punching holes fell from 7.09% to 1.45%.

  Several fixes prevent lost data or corrupted memory. Lazyfree
  huge-page races with mremap()/munmap() could lose data or access freed
  memory, and MADV_COLD could lose a concurrent write's dirty bit.
  Another fix prevents stale migration entries from outliving large
  folios. On filesystems with blocks smaller than a page, extending a
  file by 4 GiB or more could expose bytes written past the old EOF
  through mmap instead of zeroes. That is fixed, along with
  use-after-free races in PAGEMAP_SCAN during process exit and in
  memory-cgroup accounting on PREEMPT_RT kernels.

  Other fixes stop UFFDIO_MOVE spinning forever on pinned large folios,
  which could wedge other memory operations, and stop mremap() leaking
  commit charges until allocations fail under strict overcommit. A
  further fix keeps userfaultfd tracking intact on neighboring mappings.
  NUMA binding no longer prevents long-term pins when the chosen node
  has only movable memory, fixing QEMU/VFIO startup and io_uring buffer
  registration failures. MGLRU also gets a fix for early-boot crashes
  with memory cgroups disabled at boot, notably in small crash kernels.

* tag 'mm-stable-2026-10-25-19-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (213 commits)
  mm: multi-gen LRU: fix NULL lruvec->pgdat deref with memcg disabled on cmdline
  mm/page_counter: use WRITE_ONCE() for emin/elow when parent is the root
  mm/memcontrol: publish null pointer before dropping css reference
  test_maple_tree: test maple_range_64 node in RCU mode
  maple_tree: fix maple_range_64 crashes in RCU mode
  mm/vma: avoid broken uffd merge on mremap
  tools/testing/shared: catch a failed posix_memalign()
  mm/damon/core: remove unreachable damos charge_{target,addr}_from
  mm/shrinker: allocate shrinker_info_unit from a dedicated kmem_cache
  riscv: mm: exclude invalid THP PMDs from page table check
  mm/damon/core: filter out damos address filter-split failed region
  fs/proc/task_mmu: pin mm_users in do_pagemap_scan()
  mm/mempolicy: apply bind policies against the scoped allocation zone
  mm/vmscan: reclaim every zone in per-node proactive reclaim
  mm/mremap: correctly uncharge accountable VMAs in error path
  mm/mremap: populate calculated fields in vrm state correctly
  MAINTAINERS: add an entry for MEMORY MANAGEMENT - MEMORY MAP
  mm: bdi: reset min_ratio after the sysfs attributes are gone
  mm/page_vma_mapped: continue past nonmatching huge PMDs
  selftests/mm: skip hugetlb cgroup v2 tests without the needed controllers
  ...
2026-10-27 12:23:17 -10:00
Dominik Maier
87409eedc5 loop: check for read-write open mode on LOOP_SET_STATUS in lo_compat_ioctl()
lo_ioctl() checks for (mode & BLK_OPEN_WRITE) || capable(CAP_SYS_ADMIN)
before allowing LOOP_SET_STATUS or LOOP_SET_STATUS64, but not
lo_compat_ioctl(), the handler used by 32-bit user space on 64-bit
kernels.

As a result, on 64-bit kernels with CONFIG_COMPAT=y, a 32-bit
unprivileged user-space process holding a read-only (O_RDONLY) file
descriptor to an active /dev/loopN device can issue a compat
LOOP_SET_STATUS ioctl to modify lo_offset, clear lo_sizelimit to 0
(exposing backing-file data past the configured limit), or alter
lo_flags.

Enforce the same (mode & BLK_OPEN_WRITE) || capable(CAP_SYS_ADMIN) check
on LOOP_SET_STATUS in lo_compat_ioctl().

Cc: stable@vger.kernel.org
Assisted-by: ARTIST LLM
Signed-off-by: Dominik Maier <dmnk@google.com>
Reviewed-by: Bart Van Assche bvanassche@acm.org
Link: https://patch.msgid.link/20261025200740.2064379-1-dmnk@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-26 20:34:31 -06:00
Linus Torvalds
b23545529c for-7.4/block-20261021
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmrYsn8QHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgppmpEACRjRrpwbzCY47zpMyXICIFsUTqzs9MHKLh
 VZERo2w1Xdpu0GGLZAnNwbBB96pCsob5/Ipq4EaleSObkhHDYjLcev0vnLITf7Hm
 Ky5ogvofLmcpklYGP04TewoYko7tV8+KtcP3RyHpQvyTZs63dSvUeJsnZiHacc51
 Un9gB9GwbJE9EWOmF8JaHl58+qZVJXKnSnAJH/C17KYn5F9OcGsrbyDXODmE0DMT
 F44A0ZTMzDV3IJfPXg9rjc8rD5eTX+/xdbFBVFCXUofi3D3DgWHk6qVTVh6mmACp
 l8BfmfjohpJmz9rsT7FqXq5Mey4WxEhepjvat/uE97SR6WDPszruKVHfT4E47jNW
 r/hP2ogtOJAP04hklaHYeJy3gaOA90YmhZU7Idu6iOVCUuZgqFgHbKfHRp1zmMMx
 PPaenKrAQA0oBb46IsgZA9rAbF6xd8E5/B36dGDe33JYXwQGnJH046IIE28Ytq1R
 740vmq+4EJ2mCrhB8SR/7GnndTTWL/RAmhw8PkugWl9YB9uxrcOIppiyjvorKTrD
 yEKuLJW9hYNkiCz/tsE/ZOfwLaBP03JPSvx4si4g1nyKUgEF3jxnD55vkXb2kQll
 Xxa0YcQP0Bfn0oQWljzS6gmiTIcbwy2jPCu08esbo/rig5tfLjdTZmTH0oZmy4LH
 9kq45JFKhA==
 =8Czt
 -----END PGP SIGNATURE-----

Merge tag 'for-7.4/block-20261021' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull block updates from Jens Axboe:

 - NVMe updates via Keith:
     - Apple M4 (t8132) ANS2 NVMe support
     - nvme-multipath sysfs attributes for path_state, iopolicies, and
       fail_on_ctrl_loss, plus path state evaluation fixes
     - nvme-tcp parallelized I/O queue allocation and startup, and using
       the caller's network namespace
     - nvmet passthru UAF fix and rework, PR preempt use-after-free
       fixes, auth hardening, and traffic based keep alive support
     - DH-HMAC-CHAP secret attributes readable by root only
     - Various other fixes and cleanups

 - swim driver overhaul and fixes, plus floppy fixes, via a pull from
   Denis

 - Block device buffered and direct I/O rework from Tal: use
   iomap_dirty_folio, take i_rwsem for the write fallback and splice
   read, honor IOCB_NOWAIT in the buffered read path, and reject atomic
   write fallback to buffered I/O

 - Large zone revalidation rework: serialize revalidation, handle
   capacity changes by dropping and retrying zone write plugs, propagate
   read-only and offline conditions, and treat offline and read-only
   zones as dead

 - ublk robustness work around canceled FETCH rounds and going live over
   canceled io commands, dropping the default I/O scheduler, and a batch
   of selftest additions

 - blk-iocost flush cost support and zone append accounting

 - rust block fixes for Send/Sync bounds on GenDisk and TagSet, and
   import style cleanups

 - Atomic write fixes capping size by the PI buffer constraints and
   failing short atomic pins

 - Skip the redundant flush for O_DSYNC direct writes, and only use
   REQ_FUA when the device supports it

 - Store GPT attributes as a raw value

 - Remove support for swapping loop fds

 - Various other fixes and cleanups all over

* tag 'for-7.4/block-20261021' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (144 commits)
  block: restore the iterator when rejecting a misaligned bio
  blk-mq: clear stale inactive flag on hctx reuse
  block, bfq: initialize active lists for all actuators
  zloop: print device that had errors
  ublk: pin module while release work is pending
  blk-mq: drop the tag_set argument from blk_mq_free_rq_map/tags
  blk-mq: share one tags_srcu instance across all tag sets
  blk-iocost: fix stale comment in ioc_rqos_throttle()
  blk-iocost: account zone append completions in latency stats
  blk-iocost: charge zone appends as writes
  blk-iocost: add flush cost support with the flushiops model parameter
  ublk: use global index for reported zones
  selftests: ublk: add test for going live over canceled io commands
  selftests: ublk: stop a batch thread when PREP_IO_CMDS fails
  selftests: ublk: move the control command helpers into ctrl.c
  ublk: refuse to go live after an io command was canceled
  ublk: let STOP_DEV cancel the server's commands before its release
  ublk: allow a NULL io->cmd in the cancel callback
  ublk: reset the FETCH round under ub->mutex
  ublk: reset the FETCH round in release also without a disk
  ...
2026-10-24 14:14:00 -10:00
Pooyan Azad
3720122022 zram: fix short reads from block_state
read_block_state() formats each entry directly into the buffer supplied by
read().  If the remaining buffer is too small for one complete record,
snprintf() returns the full record length and the function stops without
copying data or advancing the file position.  A read from this debugfs
file which is smaller than a record therefore returns zero at a non-EOF
position and cannot make progress.

Convert block_state to seq_file so formatted records are buffered
independently of the userspace read size.  Keep dev_lock held across each
seq_file iteration and continue to protect individual entries with their
slot locks.

Link: https://lore.kernel.org/20260929071846.24829-1-pooyan.azadparvar@gmail.com
Fixes: c0265342bf ("zram: introduce zram memory tracking")
Signed-off-by: Pooyan Azad <pooyan.azadparvar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Closes: https://lore.kernel.org/r/CANC3H+LdtoydSp+o2ecErAw7k6R2+gRf9LyxcaoHv_mGhJmyQQ@mail.gmail.com/
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
2026-10-24 01:56:03 -07:00
Linus Torvalds
c0e8d30137 Modules changes for 7.4-rc1
- Ignore local labels and mapping symbols during module load
 
   These symbols were already ignored during kallsyms address-to-symbol
   lookups. Filter them out earlier during module loading to reduce lookup
   overhead and prevent them from appearing in /proc/kallsyms.
 
 - Fix potentially incorrect access of SetOnce<T> when setting Rust module
   parameters.
 
 - Fix a potential read of an uninitialized count when printing taint
   information for unloaded modules.
 
 - Allocate the kmod argument array using kmalloc_array() in preparation
   for conversion to type-aware allocators.
 
 - Clean up includes in linux/kmod.h
 
   Add explicit includes of linux/umh.h to files that use usermode helpers.
   Then clean up the #include list in linux/kmod.h, notably removing the
   compatibility linux/umh.h include.
 
 - Remove the error-injection.h include from linux/module.h
 
   Add explicit includes of linux/error-injection.h to files that use the
   ALLOW_ERROR_INJECTION() macro and currently rely on it being provided
   indirectly via linux/module.h. Then remove the unnecessary
   linux/error-injection.h include from linux/module.h.
 
 - Replace __MODULE_STRING() with __stringify() in various drivers in
   preparation for removing the former macro.
 
 The changes to several #include lists have been reported to cause trivial
 conflicts in linux-next with the drm, drm-xe, and usb trees.
 -----BEGIN PGP SIGNATURE-----
 
 iQFkBAABCABOFiEEIduBR9MnFA82q/jtumpXJwqY6poFAmrWJvAbFIAAAAAABAAO
 bWFudTIsMi41KzEuMTIsMiwyFBxwZXRyLnBhdmx1QHN1c2UuY29tAAoJELpqVycK
 mOqalOYH/RpwszqX+OuRhf3G9IDokSZFZyiAJLZan3H7jZNb9VBVLYmTTRYF/UE4
 uXKeGAUXZOaUdhVjQi/1LqX3NbDO1NfUCM9sbk3EPal0L6ILbcmkBecXu9JXHxvB
 6sfEAdTMdAn28613wcnbjmdGfEkgHuDZqZeld4dIAtZ+GvLzFz0D+o0zkigCnT4I
 faKU9GLIHJe2Cn5FB40b1+M+IGY9t6bl2+WxVc1rd9oSZXfr8ptE7NPllhiOmOhD
 /aMVpeSlXzo8DYxIhvtZGwDh5NrJglPFdFRXYuHUDLxkWCCFtXRt//LtWv3EpKqp
 dgQUH5QAO5E/+OuycHFLaXOUiKVS0P4=
 =bCLk
 -----END PGP SIGNATURE-----

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

Pull module updates from Petr Pavlu:

 - Ignore local labels and mapping symbols during module load

   These symbols were already ignored during kallsyms address-to-symbol
   lookups. Filter them out earlier during module loading to reduce
   lookup overhead and prevent them from appearing in /proc/kallsyms.

 - Fix potentially incorrect access of SetOnce<T> when setting Rust
   module parameters.

 - Fix a potential read of an uninitialized count when printing taint
   information for unloaded modules.

 - Allocate the kmod argument array using kmalloc_array() in preparation
   for conversion to type-aware allocators.

 - Clean up includes in linux/kmod.h

   Add explicit includes of linux/umh.h to files that use usermode
   helpers. Then clean up the #include list in linux/kmod.h, notably
   removing the compatibility linux/umh.h include.

 - Remove the error-injection.h include from linux/module.h

   Add explicit includes of linux/error-injection.h to files that use
   the ALLOW_ERROR_INJECTION() macro and currently rely on it being
   provided indirectly via linux/module.h. Then remove the unnecessary
   linux/error-injection.h include from linux/module.h.

 - Replace __MODULE_STRING() with __stringify() in various drivers in
   preparation for removing the former macro.

* tag 'modules-7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/modules/linux:
  drivers: Replace __MODULE_STRING() with __stringify()
  module: Fix uninitialized count read of unloaded taint tracking record
  rust: module_param: Fix potentially incorrect access of `SetOnce<T>`
  module: Remove the error-injection.h include from linux/module.h
  drm/xe: Include error-injection.h for ALLOW_ERROR_INJECTION()
  drm/i915: Include error-injection.h for ALLOW_ERROR_INJECTION()
  syscalls: Include error-injection.h for ALLOW_ERROR_INJECTION()
  net: Include error-injection.h for ALLOW_ERROR_INJECTION()
  block: Include error-injection.h for ALLOW_ERROR_INJECTION()
  module: Bring includes in linux/kmod.h up to date
  time/jiffies: Include linux/sysctl.h for proc_int_u2k_conv_uop(), ...
  umh, treewide: Explicitly include linux/umh.h where needed
  modules/kmod: Allocate argv with kmalloc_array()
  module/kallsyms: Ignore local labels and mapping symbols during module load
  module/kallsyms: Refactor current symbol filtering into is_core_symbol()
  module/kallsyms: Rename is_mapping_symbol() to is_ignored_kernel_symbol()
2026-10-23 09:32:44 -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
Linus Torvalds
734bef548a Networking changes for 7.4.
Core & protocols
 ----------------
 
  - Continue the work on removing rtnl_lock dependencies:
     - per-netns ARP and ND neighbour tables, with the default settings
       now configurable per netns (inheritance from init_net is
       controlled by the new net.core.neigh_inherit_init_net sysctl)
     - RCU-protected configuration and rtnl_lock-less fill_info() for
       hsr, netkit, sit, vlan and vxlan devices
     - per-netns device unregistration for ip tunnel and gre devices
     - use the netdev instance lock instead of rtnl_lock when reading
       speed and duplex via sysfs
     - batch the flushing of uncached routes at device unregistration
       time, relieving rtnl_lock contention on netns dismantle.
 
  - Add hardware pacing offload support, admin-controlled via a new
    rtnetlink attribute, with sch_fq integration (implemented in idpf).
 
  - Re-segment BIG TCP GSO packets into GSO packets fitting the
    egress device limits instead of plain MSS-sized segments,
    improving throughput for mixed BIG TCP / non-BIG TCP paths
    by up to 70%.
 
  - Generate RSS keys that spread flows over all the RX queues; the
    previous random keys could leave some queues unused.
 
  - Optimize the bridge VLAN forwarding paths: cache the port-VLAN in fdb
    entries and consider only VLAN members when flooding, for ~10% more
    Mpps in the fdb forwarding path.
 
  - A few TCP/IP performance improvements aimed at efficient cache
    usage and reducing contention.
 
  - Add the TCP ROCCET congestion control, a CUBIC variant aimed at
    avoiding bufferbloat in cellular networks.
 
  - Continue the conversion of getsockopt callbacks to sockopt_t.
 
  - Add an ethtool command to list the front-facing ports of an
    interface, including SFP cages and modules, using the phy_port
    representation.
 
  - Enable BIG TCP support for bareudp tunnels.
 
  - Remove the IPV6_ADDRFORM socket option and disallow buggy TCP state
    transitions (listen() + shutdown() + connect() and connect() +
    connect(AF_UNSPEC) + listen()).
 
  - Remove most BUG_ON()s from core packet processing, replacing them
    with error paths.
 
 Wireless
 --------
 
  - Latency improvements, including lockless station get/dump and beacon
    updates, plus RTNL reduction and locking cleanups.
 
  - Infrastructure for non-station TX/RX with MLO.
 
  - NAN (Wi-Fi Aware) Instant Communication support and other NAN
    improvements.
 
  - Control frame Integrity Protocol (CIP) and protected TWT support.
 
  - Improvements for AP regulatory checks.
 
 Netfilter
 ---------
 
  - Disable br_netfilter in user namespaces and schedule it for removal
    in 2027.
 
  - Restrict the raw table in nft_compat to the specific family, hook and
    priority.
 
  - Prepare the flowtable for mixed IPv4-over-IPv6 tunneling (and
    vice versa).
 
  - Use GFP_KERNEL_ACCOUNT for most netfilter allocations, for better
    integration with memcg.
 
  - Allow discovering conntrack zone filtering support in ctnetlink
    dumps, and fix nfnetlink_hook handling of large dumps.
 
 Deletions
 ---------
 
  - Move the LLC type 2 sockets out of tree. There are no known users and
    the code attracts a never-ending stream of LLM-driven fixes.
 
 Device drivers
 --------------
 
  - New drivers:
     - Meta Platforms NIC (mpnic), the second-generation NIC from Meta
     - initial skeleton of the Nebula-matrix NICs driver (nbl)
     - X-Powers AC200/AC300 Fast Ethernet PHYs
 
  - Ethernet high-speed NICs:
     - Intel:
        - i40e: XDP metadata support for RX hash and VLAN tag
        - ice: expose the E825 TSPLL state via the DPLL subsystem
     - nVidia/Mellanox:
        - move the data direct infrastructure from IB to core, in
          preparation for netdev support.
        - reduce the memory used per offloaded TC rule
     - Meta (fbnic):
        - support large io_uring zero-copy RX buffers
     - Microsoft vNIC (mana):
        - add BQL support
 
  - Ethernet NICs consumer, and embedded:
     - Airoha:
        - LRO offload support
     - Cadence (macb):
        - context swapping for ringparam and MTU changes, avoiding
          buffer loss under memory pressure
     - Mucse (rnpgbe):
        - TX/RX and link status support
     - NXP (enetc):
        - SR-IOV improvements and VF support for ENETC v4
     - Qualcomm (ppe):
        - IPQ5424 support
     - Realtek PCI (r8169):
        - phylink support
        - RSS support for RTL8127
     - Renesas (ravb):
        - gPTP support for R-Car Gen4
     - Synopsys (stmmac):
        - XDP multi-buffer support on the TX side
        - tc mqprio hw queue priority offload
        - support for RK3568 SGMII, Allwinner H616 EMAC1, UltraRISC
          DP1000 and Qualcomm sa8255p
 
  - Ethernet switches:
     - Mediatek (mt7530):
        - fast age and change conduit support
     - Microchip (ksz):
        - support for KSZ8995XA/KS8995XA
     - Microchip (lan966x):
        - PCIe FDMA support, ~20x throughput increase in PCIe endpoint
     - Microchip (sparx5):
        - Time Aware Shaper (taprio) offload
     - Motorcomm (yt921x):
        - LED and SerDes PCS support
     - Realtek (rtl8365mb):
        - EEE support
 
  - Ethernet PHYs:
     - Broadcom:
        - enable jumbo frames on BCM54xx
     - Realtek:
        - support for RTL8261CE_CG and RTL8261D_VM
        - MDIO support for RTL838x and RTL839x
 
  - WiFi drivers:
     - Broadcom (brcmfmac):
        - FT/OKC roaming offload
     - Intel (iwlwifi):
        - UHR sniffer support
        - support for newer UEFI/BIOS tables
     - MediaTek (mt76):
        - mt7925 NAN improvements
        - offchannel/scan improvements and MLO fixes
     - Morse Micro (mm81x):
        - monitor mode support
     - Qualcomm (ath12k):
        - IPQ5332 platform infrastructure
     - Realtek (rtw88):
        - RTL8723BS support
        - SDIO TX performance improvements
     - Realtek (rtw89):
        - P2P_DEVICE support
        - BT-coex updates for RTL8922D
 
  - Bluetooth:
     - move H:4 reassembly into the Bluetooth core
     - add generic support for vendor packets
     - MGMT: add security level changed event
 
  - Bluetooth drivers:
     - btusb: support Bulk Serialization Mode
     - Intel: support Draco and Titan Lake, allow unsigned firmware
     - Mediatek: MT7928 support
     - Qualcomm: QCC2072 support
     - Broadcom: Synaptics 4384 support
 
 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQJKBAABCgA0FiEEg1AjqC77wbdLX2LbKSR5jcyPE6QFAmraNIAWHHBhb2xvLmFi
 ZW5pQGdtYWlsLmNvbQAKCRApJHmNzI8TpBaeD/9iBxxaZzworKk3v+RalWo4noIC
 QsZ8E0Du7vDruS2nESbZpUpf0lKxNxJVnXEj/q0acObzUuGFJBaqZ8Uzn337w6WK
 nuM1YppPE9lIMNAgDhxKUIMGeVLHuQd3wQPsOs0nlywNehzrKYAfCUtcB3xD2H+I
 xaUdTRooop5l6GpSS0CP7li/kzHb5GagVI2VmoOFCb+0BPl6tr+ITW8s0/Z/oyZC
 Lx4Fl0Hhj0li4eHr0DS3vgS7jqmPFYOxo4zhGzXqCYaagPpvazR9RfFhP16BfJ/D
 TPI3oIkqcyvttrTtgwYhLDJjw1+m+r1vmhel7Tp5XLHQJ4WXuunPBGrq9w7Xd+IF
 JLd8VbUiXB2A/+fNSD3Q1nzukjRjlEsR2ZyRqAWqXWDhXYbAd0D/vptJJwem1ozm
 RRoe9Gk2N+iSsqvfAq6coTRPEKrlsh27v36uWQZgQ2jA2SnrNsTuJwlhiET0Jc6T
 kTEM0yjLDiUxsefOgGs5s10EnfLa2sL/0NWow0s83x6Dm3f3x2fvm2e0UlI3gLNI
 43AgMaNO1IsNOWEiJC/O81pt/6FuF8cX+cJXtlLBW1ZTJnEnVtNlafJVnyfblblx
 TXyzGtM0cUXyJsaS8/Qx1GUQO9N9MiWI4mCtDUWthBxvdpkn93G0pNXwnjybcnAH
 0nX3+pVqFZCrG/PmvQ==
 =ZOCE
 -----END PGP SIGNATURE-----

Merge tag 'net-next-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next

Pull networking updates from Paolo Abeni:
 "This includes a significant number of low-priority fixes - especially
  in the NIC drivers area - that we deferred from the last few RCs in
  the previous cycle, which can't be easily outlined in the synopsis
  below.

  Core & protocols:

   - Continue the work on removing rtnl_lock dependencies:
      - per-netns ARP and ND neighbour tables, with the default settings
        now configurable per netns (inheritance from init_net is
        controlled by the new net.core.neigh_inherit_init_net sysctl)
      - RCU-protected configuration and rtnl_lock-less fill_info() for
        hsr, netkit, sit, vlan and vxlan devices
      - per-netns device unregistration for ip tunnel and gre devices
      - use the netdev instance lock instead of rtnl_lock when reading
        speed and duplex via sysfs
      - batch the flushing of uncached routes at device unregistration
        time, relieving rtnl_lock contention on netns dismantle.

   - Add hardware pacing offload support, admin-controlled via a new
     rtnetlink attribute, with sch_fq integration (implemented in idpf).

   - Re-segment BIG TCP GSO packets into GSO packets fitting the egress
     device limits instead of plain MSS-sized segments, improving
     throughput for mixed BIG TCP / non-BIG TCP paths by up to 70%.

   - Generate RSS keys that spread flows over all the RX queues; the
     previous random keys could leave some queues unused.

   - Optimize the bridge VLAN forwarding paths: cache the port-VLAN in
     fdb entries and consider only VLAN members when flooding, for ~10%
     more Mpps in the fdb forwarding path.

   - A few TCP/IP performance improvements aimed at efficient cache
     usage and reducing contention.

   - Add the TCP ROCCET congestion control, a CUBIC variant aimed at
     avoiding bufferbloat in cellular networks.

   - Continue the conversion of getsockopt callbacks to sockopt_t.

   - Add an ethtool command to list the front-facing ports of an
     interface, including SFP cages and modules, using the phy_port
     representation.

   - Enable BIG TCP support for bareudp tunnels.

   - Remove the IPV6_ADDRFORM socket option and disallow buggy TCP state
     transitions (listen() + shutdown() + connect() and connect() +
     connect(AF_UNSPEC) + listen()).

   - Remove most BUG_ON()s from core packet processing, replacing them
     with error paths.

  Wireless:

   - Latency improvements, including lockless station get/dump and
     beacon updates, plus RTNL reduction and locking cleanups.

   - Infrastructure for non-station TX/RX with MLO.

   - NAN (Wi-Fi Aware) Instant Communication support and other NAN
     improvements.

   - Control frame Integrity Protocol (CIP) and protected TWT support.

   - Improvements for AP regulatory checks.

  Netfilter:

   - Disable br_netfilter in user namespaces and schedule it for removal
     in 2027.

   - Restrict the raw table in nft_compat to the specific family, hook
     and priority.

   - Prepare the flowtable for mixed IPv4-over-IPv6 tunneling (and vice
     versa).

   - Use GFP_KERNEL_ACCOUNT for most netfilter allocations, for better
     integration with memcg.

   - Allow discovering conntrack zone filtering support in ctnetlink
     dumps, and fix nfnetlink_hook handling of large dumps.

  Deletions:

   - Move the LLC type 2 sockets out of tree. There are no known users
     and the code attracts a never-ending stream of LLM-driven fixes.

  Device drivers:

   - New drivers:
      - Meta Platforms NIC (mpnic), the second-generation NIC from Meta
      - initial skeleton of the Nebula-matrix NICs driver (nbl)
      - X-Powers AC200/AC300 Fast Ethernet PHYs

   - Ethernet high-speed NICs:
      - Intel:
         - i40e: XDP metadata support for RX hash and VLAN tag
         - ice: expose the E825 TSPLL state via the DPLL subsystem
      - nVidia/Mellanox:
         - move the data direct infrastructure from IB to core, in
           preparation for netdev support.
         - reduce the memory used per offloaded TC rule
      - Meta (fbnic):
         - support large io_uring zero-copy RX buffers
      - Microsoft vNIC (mana):
         - add BQL support

   - Ethernet NICs consumer, and embedded:
      - Airoha:
         - LRO offload support
      - Cadence (macb):
         - context swapping for ringparam and MTU changes, avoiding
           buffer loss under memory pressure
      - Mucse (rnpgbe):
         - TX/RX and link status support
      - NXP (enetc):
         - SR-IOV improvements and VF support for ENETC v4
      - Qualcomm (ppe):
         - IPQ5424 support
      - Realtek PCI (r8169):
         - phylink support
         - RSS support for RTL8127
      - Renesas (ravb):
         - gPTP support for R-Car Gen4
      - Synopsys (stmmac):
         - XDP multi-buffer support on the TX side
         - tc mqprio hw queue priority offload
         - support for RK3568 SGMII, Allwinner H616 EMAC1, UltraRISC
           DP1000 and Qualcomm sa8255p

   - Ethernet switches:
      - Mediatek (mt7530):
         - fast age and change conduit support
      - Microchip (ksz):
         - support for KSZ8995XA/KS8995XA
      - Microchip (lan966x):
         - PCIe FDMA support, ~20x throughput increase in PCIe endpoint
      - Microchip (sparx5):
         - Time Aware Shaper (taprio) offload
      - Motorcomm (yt921x):
         - LED and SerDes PCS support
      - Realtek (rtl8365mb):
         - EEE support

   - Ethernet PHYs:
      - Broadcom:
         - enable jumbo frames on BCM54xx
      - Realtek:
         - support for RTL8261CE_CG and RTL8261D_VM
         - MDIO support for RTL838x and RTL839x

   - WiFi drivers:
      - Broadcom (brcmfmac):
         - FT/OKC roaming offload
      - Intel (iwlwifi):
         - UHR sniffer support
         - support for newer UEFI/BIOS tables
      - MediaTek (mt76):
         - mt7925 NAN improvements
         - offchannel/scan improvements and MLO fixes
      - Morse Micro (mm81x):
         - monitor mode support
      - Qualcomm (ath12k):
         - IPQ5332 platform infrastructure
      - Realtek (rtw88):
         - RTL8723BS support
         - SDIO TX performance improvements
      - Realtek (rtw89):
         - P2P_DEVICE support
         - BT-coex updates for RTL8922D

   - Bluetooth:
      - move H:4 reassembly into the Bluetooth core
      - add generic support for vendor packets
      - MGMT: add security level changed event

   - Bluetooth drivers:
      - btusb: support Bulk Serialization Mode
      - Intel: support Draco and Titan Lake, allow unsigned firmware
      - Mediatek: MT7928 support
      - Qualcomm: QCC2072 support
      - Broadcom: Synaptics 4384 support"

* tag 'net-next-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2126 commits)
  Bluetooth: btusb: disable by default Qualcomm multi-subsystem
  tipc: fix broadcast sender hang on last acker departure
  tipc: fix use-after-free of broadcast reception link at node release
  r8169: clear TX LPI on RTL8168h at link up after phylink conversion
  tun: Require CAP_NET_ADMIN to attach to an ownerless device
  net/sched/sch_cake: drop dead nla_nest_end() error check
  net/sched/sch_cake: widen buffer_used to u64
  net/sched/sch_cake: reduce parent backlog when clearing a tin
  net/sched/sch_cake: serialize reconfiguration with the datapath
  tg3: Add Datto SIRIS 5 1U Server to restart AER quirk table
  net/mlx5e: Stop asserting for RTNL when closing channels
  net: shrink the payload-only part of skb dataref to one bit
  net: wwan: iosm: validate msg_head before indexing msg_ring
  net: bgmac: rate limit RX error messages
  selftests: net: veth: test XDP_TX to a peer with GRO enabled
  veth: schedule the peer's NAPI after XDP_TX when only GRO is enabled
  pppoe: delete session hash entries by pointer match
  net: lan969x: don't disable hardirqs in fdma tx clear
  net: sparx5/lan969x: do not clobber the PSFP cycle timer update period
  net: lan969x: fix DSM calendar for empty taxis
  ...
2026-10-22 15:58:00 -10:00
Linus Torvalds
2a0d3d73c1 xen: branch for v7.4-rc1
-----BEGIN PGP SIGNATURE-----
 
 iJEEABYKADkWIQRTLbB6QfY48x44uB6AXGG7T9hjvgUCatC64hsUgAAAAAAEAA5t
 YW51MiwyLjUrMS4xMiwyLDIACgkQgFxhu0/YY75lBQD/dxTsGihelYp5Nq4eTJIZ
 ik72nKwnkNCgRWh+VgbclzwA/R71x2hcL+knXAkar9J5EJG6k4QV16gHptW/JGAX
 xHgO
 =yn95
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-7.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross:
 "This time only small fixes and cleanups all over Xen related drivers.
  Nothing really stands out here"

* tag 'for-linus-7.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen-blkfront: Fix IO race during unplug
  xen-pciback: Fix pcistub_device ref leak in pcistub_get_gsi_from_sbdf()
  xen/pcifront: check that an AER callback exists before calling it
  xen/gntdev: Fix gntdev_dmabuf ref leak in dmabuf_exp_wait_released()
  x86/PVH: don't truncate initrd address/size
  xen/privcmd: Only claim ioreqs matching an ioeventfd
  xen/scsifront: check for a NULL shadow entry on a backend response
  xen: fix typos in comments
  xen/gntdev: prevent private mappings from becoming writable
  xen: remove unused hvm_vcpu.h header
  xen-blkfront: unbind irq before tearing down ring and shadow requests
  xen/blkback: Prevent missed completion when draining I/O
  xen/pcifront: Fix PCI device reference leak in AER handling
2026-10-20 14:33:15 -10:00
Johannes Thumshirn
bdfc6433b2 zloop: print device that had errors
When testing zoned filesystems that span multiple zloop drives it can be
difficult to figure out which devices access caused an error.

Prefix the error messages where we have the disk available with the disk
name.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://patch.msgid.link/20261019150936.1819956-1-johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-19 12:58:12 -06:00
sonotri
afc9cde716 ublk: pin module while release work is pending
ublk_ch_release() takes a device reference and queues exit_work.  The VFS
module reference held through the file operations is dropped after
->release() returns.  A queued work item does not acquire its own module
reference for the callback.

Consequently, normal module removal can start while exit_work is pending or
executing.  In addition to the worker callback itself, the final device put
can invoke ublk_cdev_rel(), which is also module code.

Take a module reference while ->release() is still covered by the file
operations reference and drop it only after the worker has completed its
final device put.  A rearming worker retains the same reference.

Merely canceling exit_work during module exit is insufficient.  The worker
is the terminal path for the device reference taken by ublk_ch_release(),
so its cancellation would strand that reference and skip the associated
cleanup.

Fixes: c5c5eb24ed ("ublk: avoid ublk_io_release() called after ublk char dev is closed")
Cc: stable@vger.kernel.org
Signed-off-by: sonotri <sono7ri@gmail.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261015120654.241354-1-sono7ri@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-16 08:25:27 -06:00
Li RongQing
80897c7e5a ublk: use global index for reported zones
ublk_report_zones() may split a zone report into multiple requests when
the number of zones exceeds the temporary buffer capacity. The index
passed to disk_report_zone() must refer to the zone position in the
whole report, rather than the position within the current request.

Currently, the per-request loop index is used as the callback index,
causing each chunk after the first one to restart from zero. This can
make userspace callbacks receive duplicate zone indices and may result
in blk_revalidate_disk_zones() updating incorrect entries in its zone
state array.

Use the number of zones already reported as the base index for each
request so that zone indices remain continuous across all chunks.

Fixes: 29802d7ca3 ("ublk: enable zoned storage support")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Tested-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-13-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:35 -06:00
Josef Bacik
7bf71ecab1 ublk: refuse to go live after an io command was canceled
Since commit "ublk: keep a canceled FETCH round canceling until the
server is gone", a device whose FETCH round saw a cancel keeps its
queues canceling until the server goes away, but START_DEV and
END_USER_RECOVERY still bring it up. Without UBLK_F_USER_RECOVERY, or
with UBLK_F_USER_RECOVERY_FAIL_IO, every request of the new disk fails.
With UBLK_F_USER_RECOVERY, requests are requeued and never kicked: after
START_DEV the partition scan hangs under disk->open_mutex, and after
END_USER_RECOVERY every read parks while the command returned 0. The
server cannot fetch the canceled commands again, so the device can't
serve I/O until it restarts anyway.

Return -EBUSY from START_DEV and END_USER_RECOVERY while ub->canceling
is set. In ublk_ctrl_start_dev() check it and publish ub->ub_disk in one
cancel_mutex section, and have ublk_start_cancel() read the disk in its
cancel_mutex section. Today ublk_start_cancel() samples the disk before
taking the mutex, so a server dying during its own START_DEV can mark
the queues without quiescing a disk START_DEV published in between, with
its first I/O past the canceling check. Now either START_DEV sees the
cancel, or the cancel sees the disk and quiesces it before marking. The
END_USER_RECOVERY check is best effort: the disk exists there, and a
cancel after it is the ordinary death of the new server, which
ublk_start_cancel() handles by quiescing and marking.

Assisted-by: LLM
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-9-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:35 -06:00
Ming Lei
c8b349f9da ublk: let STOP_DEV cancel the server's commands before its release
STOP_DEV cancels the fetched commands after dropping ub->mutex, so
START_DEV and FETCH can run in between:

  STOP_DEV                          START_DEV / FETCH
  lock ub->mutex
    ublk_stop_dev_unlocked()        (not started: does nothing)
  unlock ub->mutex
                                    START_DEV goes live, schedules scan
                                    FETCH publishes a new command
  cancel_work_sync(scan)            cancels the new disk's scan
  ublk_cancel_dev()                 takes the new command: NULL io->cmd
                                    on a queue which isn't canceling

A START_DEV after STOP_DEV also goes live over the canceled commands.

Hold a reference on the server's /dev/ublkcN while canceling:

  STOP_DEV
  lock ub->mutex
    ublk_stop_dev_unlocked()
    cancel_work_sync(scan)
    server attached: take a reference on its file, set STOPPING
  unlock ub->mutex
  ublk_cancel_dev()
  drop the reference

 - STOPPING makes FETCH and PREP get UBLK_IO_RES_ABORT and START_DEV
   -EBUSY; a START_DEV or END_USER_RECOVERY waiting for the device
   to get ready wakes up too; the reset in the server's release
   clears it
 - the release can't run before the reference is dropped, so no new
   server can attach, and the cancel only meets this server's commands
 - the cancel still runs after the unlock: io_uring_cmd_done() may take
   uring_lock, under which FETCH takes ub->mutex

ublk_ch_open() saves the file in ->ch_file and ublk_ch_release() clears
it, under cancel_mutex. The release runs after the last reference is
gone, so take ours with file_ref_get(). Drop it with __fput_sync(): if
it is the last one, fput() would defer the release to this task, which
DEL_DEV then makes wait for the device to be freed.

A server which opened the device but hasn't fetched is stopped too.
Document what a server sees after STOP_DEV in ublk.rst.

Fixes: 85248d670b ("ublk: move ublk_cancel_dev() out of ub->mutex")
Cc: stable@vger.kernel.org
Reported-by: Josef Bacik <josef@toxicpanda.com>
Closes: https://lore.kernel.org/linux-block/20260928-b4-ublk-cancel-stop-v1-0-4a4360232a46@toxicpanda.com/
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-8-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:35 -06:00
Ming Lei
4915dc0a18 ublk: allow a NULL io->cmd in the cancel callback
A cancel from the control path, like STOP_DEV's ublk_cancel_dev() after
dropping ub->mutex, takes the command and clears io->cmd under
cancel_lock, then completes it with io_uring_cmd_done(), which takes
uring_lock to remove it from the cancelable list. The server's io_uring
cancel runs ublk_uring_cmd_cancel_fn() under uring_lock in between:

  control path cancel                    io_uring cancel (uring_lock)
  io->cmd = NULL, CANCELED
  io_uring_cmd_done()
    waits for uring_lock                 cmd still on the list
                                         ublk_uring_cmd_cancel_fn(cmd)
                                           io->cmd == NULL: WARN

ublk_cancel_cmd() then sees CANCELED and leaves the command alone, so
nothing is wrong; only warn if io->cmd holds another command.

Fixes: ab03a61c66 ("ublk: have a per-io daemon instead of a per-queue daemon")
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-7-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:35 -06:00
Ming Lei
84824afdb5 ublk: reset the FETCH round under ub->mutex
The release work resets the FETCH round without ub->mutex, while
START_DEV checks it under ub->mutex:

  START_DEV (ub->mutex)               release work
  all queues ready? yes
  ublksrv_tgid matches? yes
                                      ublk_reset_ch_dev():
                                        io->cmd = NULL, nr_queue_ready = 0
  go live: a request then reaches ublk_queue_cmd() with a NULL io->cmd

Do the reset under ub->mutex. Then START_DEV sees the round either ready
or reset. The work already takes ub->mutex when there is a disk, after
it has aborted the requests; nothing holding ub->mutex waits for it.

Fixes: 728cbac5fe ("ublk: move device reset into ublk_ch_release()")
Cc: stable@vger.kernel.org
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-6-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:35 -06:00
Ming Lei
f06ca594ea ublk: reset the FETCH round in release also without a disk
The release of /dev/ublkcN resets the queues only when the device has a
disk. Without one it skips ublk_reset_ch_dev():

  server fetches, never starts;         old server exits
  or STOP_DEV removed the disk           release: no disk → skip reset
                                         ios stay ACTIVE / CANCELED,
                                         nr_io_ready stays full
  new server opens /dev/ublkcN           FETCH: -EBUSY (still ready), or
                                         -EINVAL after a partial round
                                         → the device can only be deleted

All uring_cmds are done when the release work runs, with or without a
disk, so the reset is safe either way. Do it in both cases. Then a new
server can fetch and start the device again, as the STOP_DEV entry in
Documentation/block/ublk.rst says ("ublk device is ready for the new
process").

Fixes: 82a8a30c58 ("ublk: improve detection and handling of ublk server exit")
Cc: stable@vger.kernel.org
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-5-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:34 -06:00
Ming Lei
b59e96011d ublk: mark the batch fetch command cancelable before linking it
UBLK_U_IO_FETCH_IO_CMDS has the same order problem as the per-io
commands: ublk_batch_attach() links the fetch command into fcmd_head
and marks it cancelable only after dropping evts_lock. A cancel from
the control path (ublk_batch_cancel_queue()) can take it in between and
complete it, and the later mark puts a completed request on io_uring's
cancelable list.

Mark it before linking it. evts_lock orders the mark before the link,
which is where the cancel finds it.

Batch commands are not bounced to task work, so they can run from io-wq
without uring_lock, and io_uring's cancel walk can now find a fetch
command before it is linked. Two things make that safe:

 - initialize fcmd->node: it came from kzalloc(), so list_empty() saw a
   linked node and ublk_batch_cancel_cmd() would list_del_init() NULL
   pointers
 - on the -ENODEV path, complete the command with io_uring_cmd_done()
   before freeing fcmd: that removes it from the cancelable list under
   uring_lock, after which nothing can see fcmd

Also use data->cmd instead of fcmd->cmd after dropping evts_lock: once
fcmd is linked and not the active one, a control-path cancel may
complete and free it.

Fixes: a4d8837553 ("ublk: add UBLK_U_IO_FETCH_IO_CMDS for batch I/O processing")
Cc: stable@vger.kernel.org # v7.0+
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-4-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:34 -06:00
Ming Lei
a261f0caca ublk: mark the io command cancelable before publishing it
FETCH, COMMIT_AND_FETCH and NEED_GET_DATA publish the command in io->cmd
before marking it cancelable. A cancel from the control path (STOP_DEV,
QUIESCE_DEV) can complete it in between:

  issue path                       control-path cancel
  io->cmd = C
                                   take C, io_uring_cmd_done(C):
                                     C not marked, nothing to unlink
  ublk_prep_cancel(C)
    the completed C is linked on the cancelable list
  ring exit: the cancel walk hits it → GPF (KASAN, with a delay added)

Mark the command before ublk_fill_io_cmd() publishes it. The handlers
run with uring_lock held, as io_uring's cancel walk does, so marking
takes no lock and the walk can't see a marked command before it is
published. smp_wmb() orders the mark before the io->cmd store; the
cancel loads cmd with READ_ONCE(io->cmd) before reading cmd->flags.

A marked command has to be completed by io_uring_cmd_done(), so a failed
FETCH and the inline UBLK_IO_RES_OK of NEED_GET_DATA now do that. The CQE
is the same.

Fixes: 216c8f5ef0 ("ublk: replace monitor with cancelable uring_cmd")
Cc: stable@vger.kernel.org
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-3-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:34 -06:00
Ming Lei
4c454b5b26 ublk: keep a canceled FETCH round canceling until the server is gone
A cancel completes a fetched io command and sets io->cmd to NULL, but
the io still counts as ready. Only ubq->canceling stops ublk_queue_rq()
from using the NULL io->cmd. Two paths clear that flag too early:

  partial FETCH round                 recovery, two queues
  -------------------                 --------------------
  task A: FETCH tags 0-2              q0 ready: q0->canceling = false
  task A exits:                       q0 task exits:
    start_cancel(): mark queues         start_cancel(): ub->canceling
    tags 0-2: io->cmd = NULL              is still set -> q0 not marked
  task B: FETCH tag 3                   q0: io->cmd = NULL
    queue ready: canceling = false    q1 ready
  START_DEV                           END_USER_RECOVERY
  read -> ublk_queue_cmd(NULL)        read on q0 -> ublk_queue_cmd(NULL)

A FETCH round runs from the open of /dev/ublkcN until
ublk_reset_ch_dev() resets the queues. A canceled command can't be
fetched again in the same round. So the ready check only needs one
fact: did this round see a cancel? ub->canceling already records it:
ublk_start_cancel() sets it under cancel_mutex before any command is
taken. It is only cleared too early, when all queues are ready.

Fix:

 - clear ub->canceling only in ublk_reset_ch_dev()
 - when a queue gets ready, clear ubq->canceling only if ub->canceling
   is not set, and check it under cancel_mutex

The check and the marking are ordered by cancel_mutex:

  check first:   queue cleared -> start_cancel() marks it again
                 -> command taken
  cancel first:  check sees ub->canceling -> queue stays canceling

While ub->canceling is set, no queue clears its flag. So the "all
queues marked" shortcut in ublk_start_cancel() is correct again.

UBLK_F_BATCH_IO follows the same rule. It does not dispatch through
io->cmd, so it never hit the oops, but a round which lost a fetch
command is treated the same way: it has to start over.

Fixes: 728cbac5fe ("ublk: move device reset into ublk_ch_release()")
Fixes: 3f38507855 ("ublk: fix batch I/O recovery -ENODEV error")
Cc: stable@vger.kernel.org # v6.17+: needs cancel_mutex
Reported-by: Josef Bacik <josef@toxicpanda.com>
Closes: https://lore.kernel.org/linux-block/20260928-b4-ublk-cancel-stop-v1-0-4a4360232a46@toxicpanda.com/
Tested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261011063555.1142277-2-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 18:25:34 -06:00
Paolo Bertinetti
aaf4902304 ublk: hold RCU read lock in ublk_try_buf_match()
syzbot reports a lockdep splat when I/O is dispatched to a ublk device
with UBLK_F_SHMEM_ZC enabled:

  WARNING: suspicious RCU usage
  lib/maple_tree.c:720 suspicious rcu_dereference_check() usage!
  ...
  Call Trace:
   mas_root lib/maple_tree.c:720 [inline]
   mas_start+0x3cc/0x640 lib/maple_tree.c:1250
   mas_state_walk lib/maple_tree.c:3006 [inline]
   mas_walk+0x1db/0x490 lib/maple_tree.c:4458
   ublk_try_buf_match drivers/block/ublk_drv.c:5639 [inline]
   ublk_init_iod+0x5d2/0x1120 drivers/block/ublk_drv.c:521
   ublk_dispatch_req+0x97/0x9c0 drivers/block/ublk_drv.c:1776
   tctx_task_work_run+0x73d/0xa80 io_uring/tw.c:96

ublk_try_buf_match() calls mas_walk() on the buffer tree without
holding the RCU read lock or the tree lock. Writers are already
excluded because ublk_lock_buf_tree() freezes the queue, so there is
no real race, but maple tree readers must still hold one of the two.

Take the RCU read lock around the walk.

Fixes: 4d4a512a1f ("ublk: add PFN-based buffer matching in I/O path")
Reported-by: syzbot+b48868c46e62c1c4cb2c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b48868c46e62c1c4cb2c
Assisted-by: LLM
Signed-off-by: Paolo Bertinetti <paolobertinetti200f4@proton.me>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/179010105967.8478.2344875677216734809@proton.me
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-15 14:34:10 -06:00
Jakub Kicinski
f5e575a787 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR (net-7.3-rc8).

No conflicts. Adjacent changes:

drivers/net/ethernet/microchip/lan865x/lan865x.c
  2a3f6d2a9a ("microchip: lan865x: move setting of netops to fix crash")
  15358c2c3d ("net: ethernet: oa_tc6: return ERR_PTR from oa_tc6_init()")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-15 09:24:47 -07:00
Christoph Hellwig
a408a6e074 zloop: explicitly mention zone condition when a write fails to it
Don't print the impossibly large write pointer, but directly mention
the zone condition when a write to a zone in a condition that does
not allow writes is received.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://patch.msgid.link/20261012141551.1336261-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-12 10:28:45 -06:00
Christian Brauner
d4fabede1d loop: remove support for swapping loop fds
LOOP_CHANGE_FD swaps the backing file of a bound read-only loop device
for another file of the same size. The comment above loop_change_fd()
says this is for installers that want to free the original image and
for HA setups that want to switch to another copy of the image. When we
discussed deprecating it in 2023 (cf. [1]) we found no users at all:
zero hits on codesearch.debian.net, GitHub code search and
cs.android.com. The only things that exercise it are strace, LTP,
stress-ng and blktests. Everyone agreed to drop it. I just never sent
the patch.

Since then we found several more problems with it and all of them are
structural. The ioctl changes what a block device is backed by after a
filesystem has been mounted on it and nothing else in the kernel does
that.

(1) It creates a lock order cycle.

    loop_change_fd() is the only loop operation that calls
    disk_force_media_change() on a bound device while a filesystem can
    be mounted on it. loop_configure() calls it before the device is
    bound and __loop_clr_fd() after the last opener is gone. And it
    calls it with lo->lo_mutex held.

    Since v6.6 disk_force_media_change() doesn't just bump the disk
    sequence number. It calls bdev_mark_dead() which calls into the
    holder, i.e., fs_bdev_mark_dead(), which takes sb->s_umount of
    every superblock on that device. So LOOP_CHANGE_FD gives us:

        lo_mutex -> s_umount

    Mounting a filesystem takes s_umount in sget_fc() and then opens
    the block device in setup_bdev_super(). That takes
    disk->open_mutex and calls lo_open() which takes lo_mutex:

        s_umount -> open_mutex -> lo_mutex

    That's a cycle. Lockdep reports it as soon as LOOP_CHANGE_FD is
    used on a device that has a filesystem mounted on it. This was
    recently hit with erofs where LOOP_CHANGE_FD raced with umount and
    a concurrent open of the loop device. And it is a real deadlock:
    the mounter holds s_umount and waits for open_mutex, the opener
    holds open_mutex and waits in lo_open() for lo_mutex, and the
    LOOP_CHANGE_FD caller holds lo_mutex and waits in
    fs_bdev_mark_dead() for that superblock.

    Note that we went through the block layer in v6.7 to guarantee
    that s_umount is never taken under open_mutex. LOOP_CHANGE_FD is
    the reverse direction and it was simply never considered.

(2) The use-case it was added for doesn't work anymore.

    fs_bdev_mark_dead() shuts the filesystem down. For ext4, xfs and
    btrfs that means ->shutdown() is called and the mounted filesystem
    returns -EIO from then on. So swapping the image under a mounted
    filesystem can't work for any filesystem that implements shutdown.
    It only survives on erofs because erofs deliberately doesn't
    implement ->shutdown() and ->remove_bdev(). Commit 69139a62a9
    ("erofs: open via dedicated fs bdev helpers") explicitly cites
    loop_change_fd() as the reason why it shouldn't. IOW, an ioctl
    without users dictates what a filesystem is allowed to do on
    device removal.

    And it never worked on partitions. disk_force_media_change() only
    acts on disk->part0 so a filesystem mounted on loop0p1 isn't told
    anything when the image under it is swapped.

(3) It can create superblock pin cycles.

    loop_validate_file() only guards against loop-on-loop recursion.
    It doesn't stop LOOP_CHANGE_FD from pointing a bound device at a
    file on the filesystem that is mounted from that very device, or
    two devices at files on each other's filesystems, or a device at a
    file on a fuse mount whose passthrough backing file lives on the
    loop mount. Static setups can't form these cycles because the
    backing file is opened before the filesystem on top of it exists.
    LOOP_CHANGE_FD is the only block layer path where the edge is
    added afterwards.

    The result is a cycle of superblocks: the backing file pins the
    mount, the mount pins the superblock, the superblock holds the
    device open and the device holds the backing file. umount detaches
    the mounts but nothing ever frees them and the mount namespace
    they live in leaks with them. This is not a cycle of mounts so
    nothing in mount teardown can break it. It's root-only, but it is
    a permanent leak that can't be undone.

(4) It makes filesystem stacking dynamic.

    s_stack_depth assumes that the dependencies between filesystems
    are fixed when a filesystem is mounted. With LOOP_CHANGE_FD the
    image of a mounted filesystem can be moved onto another filesystem
    at any later time, so a loop-mounted filesystem is at stacking
    depth 0 no matter what its image ends up on. That is the hole in
    the stacking deadlock discussion for fanotify pre-content events
    (cf. [2]).

The partition handling of LOOP_CHANGE_FD has been broken since v7.1
and nobody noticed until Daan ran into it in August (cf. [3]). That's
about the level of use this ioctl sees.

So let's remove it. LOOP_CHANGE_FD now returns -EOPNOTSUPP.

[1]: https://lore.kernel.org/r/20231023-biberbau-spatzen-282ccea0825a@brauner
     https://lore.kernel.org/r/20231024-entfuhr-sachbezogen-aab33dec4087@brauner
[2]: https://lore.kernel.org/r/CAOQ4uxi2Mx4ZB48DhQJWOvt6UBur3LnrkttgRjo72U4+Cu81iQ@mail.gmail.com
     https://lore.kernel.org/r/20260617-vorfahren-haften-nullnummer-b0d6fccadae3@brauner
[3]: https://lore.kernel.org/r/20260806-b4-loop-nbd-stale-partitions-v1-1-67bb75a8d7be@amutable.com

Signed-off-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20261012-work-loop-change_fd-v1-1-3cf4ec349bbb@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-12 10:28:26 -06:00
Linus Torvalds
4375b45d70 block-7.3-20261010
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmrLiicQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpvOmD/452m7OeggU07h2q1wqdiw2lh5zIvXcjQIF
 ih4nl5lezismqbenazF6IqSsz5YAq5SM0EroNEXrQnr2UzndjyXyVN3fPdQVA+7R
 8Hg3rlU31XzGW+WZknGx25RfaIGovNbJUFhPMuYpY41raOSevwIhx2X3k5UZUAWd
 4id28sXJTMk097XdQnfqNcaXcu3FDHx9ZcOKlSyRWaZD36vY4XPFwrFESyMzyWWJ
 PhfwTBG6/MxxzOS0QdCzkSpA1L1Ipj48LO87X/RMX8NnrXw5Gar6+1NhVykfocdb
 acKxUaAw5VF72Uinrrm+f7tMIAmsoFzwJR+VXJJxYNQMB2GLBL69BOsz9Qmr6qaA
 71GQ52wfGh8fajeUH5C+pTDab4zZwY9X+ugGoocXaK/f43vxLARYLevC/MEionD/
 HbZazH79Ock4dLolMBKgDXhrLUZbk/d0TiJpJezaaO+v09KlWDyhf+uzFOKkfdUL
 YUsXGkQT+cp1ymN2M7Stiey+b2EMPhU8NjL/Sb52o3gllxeP8tUfXfGimxIWH1k3
 fhzqYHpZNROCB8wzqeawqkZzJPpe7Xj5H5FRDf6fiqWZ+BelD1Je+mq1Ck53XLKr
 tmDnmFwl7B+FrX519u4BqObW95PKC/0JsrmW5BeW+mHjbIHnOCTVsZiEoW+Q+Q57
 3twF8ITLUA==
 =jxPV
 -----END PGP SIGNATURE-----

Merge tag 'block-7.3-20261010' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull block fixes from Jens Axboe:

 - NVMe fixes via Keith:
     - Fix swapped ZRASF zone state values for full and read only
     - nvme-multipath revalidate head zones after unfreezing the head
       queue
     - Revert "nvme: do not reset controllers in NVME_CTRL_NEW state",
       which broke things
     - nvmet fixes for invalid NSIDs on feature 82h and using the local
       P2P device on metadata allocation failure

 - zloop: zero out only the unread tail of a short read

* tag 'block-7.3-20261010' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  Revert "nvme: do not reset controllers in NVME_CTRL_NEW state"
  zloop: zero out only the unread tail of short reads
  nvmet: use the local P2P device on metadata allocation failure
  nvme-multipath: revalidate head zones after unfreezing the head queue
  nvme: fix swapped ZRASF zone state values for full and read only
  nvmet: return Invalid Field for invalid NSIDs feature 82h
2026-10-11 09:00:33 -07:00
Ross Lagerwall
61b6d1df1d xen-blkfront: Fix IO race during unplug
During unplug, blkfront stops the hw queues and marks the disk as dead,
then later during removal calls del_gendisk(). However, IO issued after
the hw queues are stopped but before the call to del_gendisk() will be
queued but never handled. This causes del_gendisk() to hang forever
waiting for the queue refcount to drop to zero.

This can be reproduced by issuing IO during an artificial delay after
stopping the hw queues.

Fix this by simply not stopping the hw queues directly. Marking the disk
as dead already freezes the queue which prevents new requests being
added and it synchronously runs the hw queues to clear anything pending.
If the hw queues are stopped when calling blk_mark_disk_dead(), running
the hw queues is a no-op and can leave queued requests unprocessed.

Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Roger Pau Monné <roger@xenproject.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20261006163411.2583538-1-ross.lagerwall@citrix.com>
2026-10-09 17:16:16 +02:00
Yuchao Zhang
f3e27b7955 xen-blkfront: unbind irq before tearing down ring and shadow requests
In blkif_free_ring(), the driver tears down the ring's persistent grants,
shadow request arrays, and shared ring structure (xenbus_teardown_ring),
and only calls unbind_from_irqhandler() at the very end.

While blkif_free_ring() is freeing persistent grants and clearing the
shadow array, the event channel interrupt (blkif_interrupt) is still
registered and active.  If an interrupt arrives from the backend during
this teardown window, blkif_interrupt() reads rinfo->ring.sring and,
via blkif_completion(), accesses rinfo->shadow[id].grants_used and
rinfo->shadow[id].sg.  blkif_free_ring() tears these structures down
without holding rinfo->ring_lock, and the handler only checks
info->connected at entry, so this is a real race resulting in a
use-after-free or NULL pointer dereference.

Fix this by moving unbind_from_irqhandler() to the beginning of
blkif_free_ring().  Calling unbind_from_irqhandler() first frees the
IRQ and synchronizes with any in-flight interrupt handlers on other CPUs
before ring memory and shadow request structures are deallocated,
matching the teardown order in drivers/net/xen-netfront.c.

Fixes: 11659569f7 ("xen/blkfront: split per device io_lock")
Cc: stable@vger.kernel.org
Signed-off-by: Yuchao Zhang <ndaugoing@gmail.com>
Acked-by: Roger Pau Monné <roger@xenproject.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260922072155.34625-1-ndaugoing@gmail.com>
2026-10-09 09:58:46 +02:00
Gui-Dong Han
9b4df0baa2 xen/blkback: Prevent missed completion when draining I/O
xen_blk_drain_io() sets drain before checking inflight.
xen_blkbk_unmap_and_respond_callback() decrements inflight with
atomic_dec_and_test() before checking drain.

The pre-wait condition check was added to avoid missing a completion, but
atomic_set() is unordered. With one I/O in flight, the drain path can set
drain to 1 and read inflight as 1 before the completion decrement. The
completion path then decrements inflight to 0 but can still read drain as
0. It skips complete(), so the drain path waits until the timeout despite
no I/O remaining.

Add a full barrier between setting drain and reading inflight.
atomic_dec_and_test() already provides full ordering on the completion
side.

Fixes: 6927d92091 ("xen/blkback: Fix two races in the handling of barrier requests.")
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Acked-by: Roger Pau Monné <roger@xenproject.org>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260730084000.3305702-1-hanguidong02@gmail.com>
2026-10-09 09:58:46 +02:00
Sergey Senozhatsky
803f6a03f2 zram: convert to SG-list zsmalloc object read API
Patch series "zsmallc: remove old object read API".

zram remains the only user of old zsmalloc object read API.  This series
removes the old API and converts zram to use the new SG-list based API.


This patch (of 2):

zram remains the last user of old zsmalloc object read API, that performed
linearisation on the zsmalloc side.  There is a new SG-list API, that has
a bunch of benefits.  Switch zram to SG-list zsmalloc object read API.

Link: https://lore.kernel.org/20260907105739.1793316-1-senozhatsky@chromium.org
Link: https://lore.kernel.org/20260907105739.1793316-2-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
2026-10-08 22:54:58 -07:00
Jakub Kicinski
d8674294ae Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR (net-7.3-rc7).

Conflicts:

include/net/strparser.h
  0984ebc631 ("strparser: make sure __strp_recv isn't running before tearing down the parser")
  02fd0a2111 ("net: strparser: removed the aborted bit and aborts counter")
https://lore.kernel.org/asYfmLsfy-SCxXjr@sirena.co.uk

Adjacent changes:

Documentation/networking/strparser.rst
  5f193cdabf ("docs: networking: strparser: remove general mode")
  0984ebc631 ("strparser: make sure __strp_recv isn't running before tearing down the parser")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-08 22:21:56 -07:00
Josef Bacik
e1274a6bc4 aoe: pull in the headers each received packet type reads
aoenet_rcv() only pulls the AoE and ATA headers into the skb head when
the packet is long enough to hold both.  A shorter packet goes through
unpulled, and aoenet_rcv() reads the AoE header from it anyway.  CFG
responses go on to aoecmd_cfg_rsp(), which reads the config header
after it, and ATA responses get queued for ktiocomplete(), which
skb_pull()s both headers.  Ethernet pads frames to 60 bytes, so this
mostly takes a virtual link, but nothing stops a short frame from
getting here.

Pull the AoE header up front and drop the packet if it isn't there,
then pull the ATA or config header in the switch arm that hands the
packet on, so each path gets the headers it reads.  This also replaces
the open-coded __pskb_pull_tail() with pskb_may_pull().

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261007-b4-aoe-short-packets-v1-1-db5155f7bb9c@toxicpanda.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-10-07 13:23:27 -06:00
Sergey Senozhatsky
eb2c18a5f1 zram: remove unreachable kernel_read_file_from_path() return check
Sashiko reported that:
kernel_read_file_from_path() returns negative error for zero-sized
files, so we cannot have "sz == 0" return, remove it and use a
generic error message instead.

Link: https://lore.kernel.org/20260901051335.2202390-1-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Haoqin Huang <haoqinhuang7@gmail.com>
2026-10-06 17:39:33 -07:00
Hao Jia
59042a88ef zram: fix idle age_sec underflow in idle_store()
After commit 2e8ff2f51d ("zram: use u32 for entry ac_time tracking"),
idle_store() computes the idle cutoff as:

	cutoff = ktime_sub((u32)ktime_get_boottime_seconds(), age_sec);

Because the left operand is cast to u32, when age_sec exceeds the current
uptime the subtraction wraps modulo 2^32 and the huge result is
zero-extended into the s64 cutoff.  mark_idle() then marks every entry as
idle instead of matching nothing.  For instance, running

	echo 86400 > /sys/block/zramX/idle

on a machine up for only two minutes marks all newly written pages idle
and hands them to idle writeback and recompression.

No slot can have been accessed before the system booted, so an age_sec
that reaches back past uptime cannot match any slot.  Return early in that
case, without walking the table or taking any slot locks.

Track the cutoff as time64_t rather than ktime_t.  Both cutoff and ac_time
are boot-time values in seconds, so a plain arithmetic comparison against
ac_time in mark_idle() is correct and no ktime helpers are needed.

Link: https://lore.kernel.org/20260828083149.45760-1-jiahao.kernel@gmail.com
Fixes: 2e8ff2f51d ("zram: use u32 for entry ac_time tracking")
Signed-off-by: Hao Jia <jiahao1@lixiang.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Minchan Kim <minchan@kernel.org>
Cc: <stable@vger.kernel.org>
2026-10-06 17:38:56 -07:00
Eric Dumazet
24280d1d28 drbd: use sk_set_nospace()
Use the new helpers instead of open coding the SOCK_NOSPACE
manipulation, so that TCP can later maintain a cheaper private
copy of this bit.

No functional change intended.

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Acked-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Link: https://patch.msgid.link/20260929071743.23624-7-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-10-05 16:04:49 -07:00
Denis Efremov (Oracle)
bb38473f1b floppy: return the drive state flags from the 32-bit FDGETDRVSTAT
compat_getdrvstat() copies every field of the drive state to a 32-bit
caller except ->flags, which stays zero. 32-bit FDGETDRVSTAT and
FDPOLLDRVSTAT therefore never report FD_DISK_WRITABLE, FD_DISK_CHANGED
or FD_VERIFY: i386 fdutils (floppycontrol -P, fdmount), and other
32-bit users see every disk as write-protected and never see a disk
change. The compat code in block/compat_ioctl.c copied the field;
it was lost when that code moved into floppy.c

Also declare the field as compat_ulong_t: the 32-bit struct
floppy_drive_struct starts with an unsigned long, and a signed char at
offset 0 only lines up with its low byte on little-endian machines. The
size and offsets of the compat structure, and so FDGETDRVSTAT32, do not
change.

Cc: stable@vger.kernel.org
Fixes: 229b53c9bf ("take floppy compat ioctls to sodding floppy.c")
Link: https://patch.msgid.link/20260924112825.3525931-1-efremov@linux.com
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05 18:59:41 +04:00
Denis Efremov (Oracle)
66be62ee5d floppy: don't store a stack buffer in timeout_message
request_done() formats "request done %d" into a buffer on its stack and
passes it to reschedule_timeout(), which keeps the pointer in
timeout_message. show_floppy() prints timeout_message long after
request_done() has returned, e.g. from result() in the interrupt
handler, and reads a dead stack frame:

  BUG: KASAN: stack-out-of-bounds in string+0x39c/0x3d0 lib/vsprintf.c:720
  Read of size 1 at addr ffffc900003cfc70 by task swapper/3/0
  Call Trace:
   <IRQ>
   ...
   show_floppy+0xb1/0x45f drivers/block/floppy.c:1838
   result.cold+0x2b/0x30 drivers/block/floppy.c:1183
   floppy_interrupt+0x191/0x340 drivers/block/floppy.c:1755
   floppy_hardint+0x1a7/0x200 arch/x86/include/asm/floppy.h:66

uptodate is either 0 or 1, so pass one of two string literals instead.

Cc: stable@vger.kernel.org
Fixes: 73507e6cd8 ("drivers/block/floppy.c: remove unnecessary argument from [__]reschedule_timeout")
Reported-by: syzbot+874c2707f97fac24b090@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=874c2707f97fac24b090
Link: https://patch.msgid.link/20260924094839.3239569-1-efremov@linux.com
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05 18:59:41 +04:00
Cen Zhang
9dfafe7ed0 floppy: annotate data-races around command_status and floppy_work_fn
command_status is accessed by multiple contexts:
 - generic_done() and do_wakeup() write it from the floppy
   workqueue context.
 - wait_til_done() reads it in wait_event conditions without
   holding fdc_busy.
 - is_alive() reads it locklessly to check driver liveness.
 - floppy_queue_rq(), lock_fdc(), and unlock_fdc() write it
   during FDC ownership transitions.

There is currently no LKMM annotation for these concurrent accesses
since command_status relies on the deprecated volatile qualifier.
Remove volatile and use READ_ONCE()/WRITE_ONCE() on every access
to command_status to provide proper LKMM data-race annotations.

Also annotate floppy_work_fn with WRITE_ONCE() in schedule_bh()
and READ_ONCE() in floppy_work_workfn(), and current_type[drive]
with READ_ONCE() in drive_no_geom() where it can be read without
holding the FDC lock.

The races were found by our tools:

 1) command_status: generic_done (write) vs wait_til_done (read)

  ============ DATARACE ============
  Function: generic_done+0x54/0xa0 drivers/block/floppy.c:985
  Function: success_and_wakeup+0xeb/0x1e0 drivers/block/floppy.c:2046
  Function: setup_rw_floppy+0x15dc/0x1d80 drivers/block/floppy.c:1046
  Function: floppy_ready+0x2630/0x4000
  Function: floppy_work_workfn+0x56/0x70 drivers/block/floppy.c:1012
  Function: process_one_work kernel/workqueue.c:3236 [inline]
  Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319
  ============OTHER_INFO============
  Function: wait_til_done+0x134/0x740 drivers/block/floppy.c:2026
  Function: poll_drive+0x1fa/0x2a0
  Function: fd_ioctl+0x13c8/0x1da0 drivers/block/floppy.c:3873
  Function: blkdev_ioctl+0x421/0x510 block/ioctl.c:705
  Function: vfs_ioctl fs/ioctl.c:51 [inline]
  Function: __do_sys_ioctl fs/ioctl.c:598 [inline]
  Function: __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
  =================END==============

 2) current_type[drive]: drive_no_geom (read) vs set_geometry (write)

  ============ DATARACE ============
  Function: drive_no_geom drivers/block/floppy.c:606 [inline]
  Function: floppy_check_events+0x9c9/0xcf0 drivers/block/floppy.c:4187
  Function: disk_check_events+0xca/0x4d0 block/disk-events.c:193
  Function: process_one_work kernel/workqueue.c:3236 [inline]
  Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319
  Function: worker_thread+0xb97/0x11d0 kernel/workqueue.c:3400
  Function: kthread+0x3d4/0x800 kernel/kthread.c:463
  ============OTHER_INFO============
  Function: set_geometry+0xe1d/0x1980 drivers/block/floppy.c:2237
  Function: fd_ioctl+0xff4/0x1da0 drivers/block/floppy.c:3912
  Function: blkdev_ioctl+0x421/0x510 block/ioctl.c:705
  Function: vfs_ioctl fs/ioctl.c:51 [inline]
  Function: __do_sys_ioctl fs/ioctl.c:598 [inline]
  Function: __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
  =================END==============

 3) floppy_work_fn: schedule_bh (write) vs
    floppy_interrupt->schedule_bh (write)

  ============ DATARACE ============
  Function: schedule_bh drivers/block/floppy.c:1005 [inline]
  Function: do_wakeup+0x19c/0x220 drivers/block/floppy.c:3219
  Function: success_and_wakeup+0x192/0x1e0 drivers/block/floppy.c:1994
  Function: setup_rw_floppy+0x15dc/0x1d80 drivers/block/floppy.c:1046
  Function: floppy_ready+0x2630/0x4000
  Function: floppy_work_workfn+0x56/0x70 drivers/block/floppy.c:1012
  Function: process_one_work kernel/workqueue.c:3236 [inline]
  Function: process_scheduled_works+0x7a8/0x1030 kernel/workqueue.c:3319
  ============OTHER_INFO============
  Function: floppy_interrupt+0xbf4/0x1220
  Function: floppy_hardint+0x432/0x630
  Function: __handle_irq_event_percpu+0x10a/0x5d0 kernel/irq/handle.c:158
  Function: handle_irq_event+0x8b/0x1e0 kernel/irq/handle.c:210
  Function: handle_edge_irq+0x223/0x9f0 kernel/irq/chip.c:855
  =================END==============

Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Link: https://patch.msgid.link/20260318034810.3089217-1-zzzccc427@gmail.com
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05 18:59:41 +04:00
Guangshuo Li
f1e72d80ad floppy: unregister platform device on add_disk failure
The change referenced by the Fixes tag reverted a previous fix because
that fix added incorrect cleanup for the platform_device_register()
failure path.

However, reverting the whole change also removed the cleanup for a later
failure path. If platform_device_register() succeeds but device_add_disk()
fails, the current floppy platform device has already been registered and
registered[drive] has been set.

The common out_remove_drives path uses while (drive--), so it starts from
the previous drive and does not unregister the current one. As a result,
the platform device registered for the failing drive is leaked.

Unregister the current platform device directly on the device_add_disk()
failure path, where platform_device_register() is known to have
succeeded. Leave the platform_device_register() failure path unchanged.

Fixes: 895a9b3791 ("Revert "floppy: fix reference leak on platform_device_register() failure"")
Fixes: 47d34aa2d2 ("floppy: add error handling support for add_disk()")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Link: https://patch.msgid.link/20260708105703.747262-1-lgs201920130244@gmail.com
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05 18:59:41 +04:00
Yang Xiuwei
7c82781039 floppy: avoid NULL deref in reset_interrupt when cont is cleared
reset_fdc() arms do_floppy = reset_interrupt; the IRQ handler then
queues that function via schedule_bh(). If unlock_fdc() or do_wakeup()
clears cont before the work runs, reset_interrupt() dereferences a NULL
cont and oopses.

Example crash excerpt:

[ 1070.468148] status=80
[ 1070.468152] fdc_busy=1
[ 1070.468158] cont=          (null)
[ 1070.468161] current_req=          (null)
[ 1070.468162] command_status=-1
[ 1070.468163]
[ 1070.557051] floppy0: floppy timeout called
[ 1070.557053] no cont in shutdown!
[ 1070.557056] floppy0: floppy_shutdown: timeout handler died.
[ 1074.419509] floppy0: FDC access conflict!
[ 1074.419782] BUG: unable to handle kernel NULL pointer dereference at
0000000000000008
[ 1074.421969] PGD 0 P4D 0
[ 1074.422320] Oops: 0000 [#1] SMP NOPTI
[ 1074.422648] CPU: 10 PID: 3269 Comm: kworker/u256:4 Kdump: loaded
[ 1074.423830] Hardware name: inspur Standard PC (i440FX + PIIX, 1996),
BIOS 0.0.0 02/06/2015
[ 1074.424284] Workqueue: floppy floppy_work_workfn [floppy]
[ 1074.424757] RIP: 0010:reset_interrupt+0x3a/0xa0 [floppy]

The same NULL deref has also been reported by syzbot on upstream.

Return early if cont is already NULL after result(). The hardware reset
has completed; result() still drains the FDC. A later request can lock
the FDC and reset again. This is a defensive fix for stale work, not a
rewrite of the floppy continuation state machine.

Reported-by: syzbot+619e27617b2abe6b9b72@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-block/00000000000093c4d105f9aa34d6@google.com/
Link: https://lists.openwall.net/linux-kernel/2021/10/27/56
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Link: https://patch.msgid.link/20260723073512.11120-1-yangxiuwei@kylinos.cn
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05 18:59:41 +04:00
Karl Mehltretter
74c2e2eeb7 floppy: flush pending work before releasing resources on init failure
do_floppy_init() probes each FDC with user_reset_fdc(), which queues a
redo_fd_request() work item on floppy_wq that may still be pending when
the probe finishes. When no controller is found, the error path calls
floppy_release_irq_and_dma() to free the IRQ and DMA channel, and only
later destroys the workqueue. destroy_workqueue() drains the queued work
last, so it can run after the IRQ and DMA are already gone:

  floppy0: no floppy controllers found
  work still pending

The flush used to be here. Commit 070ad7e793 ("floppy: convert to
delayed work and single-thread wq") renamed the label out_flush_work to
out_release_dma and dropped it. Restore it so the work drains before the
IRQ and DMA are released, as floppy_module_exit() already does.

Fixes: 070ad7e793 ("floppy: convert to delayed work and single-thread wq")
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Link: https://patch.msgid.link/20260722034435.13432-1-kmehltretter@gmail.com
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
2026-10-05 18:02:28 +04:00