Linux/linux d06ce6f — drivers/vhost vhost.c

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull vhost fix from Michael Tsirkin:
 "Another high priority bugfix. Working on more"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  vhost: reject used ring batches larger than the ring
  Revert "vhost: split out-of-order used ring batches at every wrap"
DeltaFile
+18-9drivers/vhost/vhost.c
+18-91 files

Linux/linux 9842e94 — drivers/vhost vhost.c

Revert "vhost: split out-of-order used ring batches at every wrap"

This reverts commit 5570a998b884c988dbe105430d7e2d8e9411e37e.

Commit 5570a998b884 ("vhost: split out-of-order used ring batches at
every wrap") addressed completion batches larger than the ring on the
out-of-order path, but did not cover all paths (such as the in-order
dirty-log replay loop).

Revert it; a follow-up patch will address all paths in a more consistent
manner.

Cc: stable at vger.kernel.org
Fixes: 5570a998b884 ("vhost: split out-of-order used ring batches at every wrap")
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
DeltaFile
+6-9drivers/vhost/vhost.c
+6-91 files

Linux/linux 700737d — drivers/vhost vhost.c

vhost: reject used ring batches larger than the ring

A compliant driver never has more than vq->num buffers in flight at
once, so a batch accumulated before used->idx advances never exceeds
vq->num.

Reject used count > vq->num in
vhost_add_used_n()/vhost_add_used_n_in_order().

Cc: stable at vger.kernel.org
Reported-by: Seohyeon Maeng <bioloidgp at gmail.com>
Reported-by: minki at morningstarsec.dev
Reported-by: YanXin Li <fadouse at pm.me>
Fixes: e2b3b35eb989 ("vhost_net: batch used ring update in rx")
Fixes: 4afb52c2af44 ("vhost_net: batch update used ring for datacopy TX")
Fixes: bfcde6b64769 ("vhost: fix dirty logging for in-order used ring entries")
Cc: Jason Wang <jasowangio at gmail.com>
Cc: Eugenio Pérez <eperezma at redhat.com>
Message-ID: <66327153423e98bd10778bac1f29c26ba633e02a.1796163071.git.mst at redhat.com>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
DeltaFile
+12-0drivers/vhost/vhost.c
+12-01 files

Linux/linux 0810bd2 — arch/um Makefile, arch/um/drivers vector_transports.c vector_kern.h

Merge tag 'uml-fixes-7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

Pull uml fixes from Johannes Berg:

 - vector network driver (NAPI, hardening)

 - rust module loading

 - FD initialization in time-travel messages

* tag 'uml-fixes-7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
  um: time-travel: don't use uninitialized fds from START ACK
  um: vector: Don't clean up NAPI that was never set up
  um: vector: Possible underflow and races fixes
  rust: arch/um: Fix loading Rust modules
DeltaFile
+36-20arch/um/drivers/vector_kern.c
+12-4arch/um/kernel/time.c
+0-3arch/um/drivers/vector_transports.c
+1-2arch/um/drivers/vector_kern.h
+0-2arch/um/Makefile
+49-315 files

Linux/linux 5223181 — arch/um/kernel time.c

um: time-travel: don't use uninitialized fds from START ACK

When the kernel connects to an external time-travel controller, it
expects the ACK of its UM_TIMETRAVEL_START message to carry two file
descriptors: the shared memory area and a log file. It reads them with
os_rcv_fd_msg() into an uninitialized on-stack array, and then uses
both array elements whenever the message itself was received in full.

os_rcv_fd_msg() leaves the array untouched if the message came without
an SCM_RIGHTS control message. That is what any controller that does
not implement the shared memory extension sends, which the protocol
allows: such controllers are why the kernel falls back to message
based scheduling. In that case the kernel passes stack garbage to
mmap() and then close()s both values.

With CONFIG_INIT_STACK_ALL_ZERO, the default where the compiler
supports it, the garbage is 0, so the kernel closes its own stdin. The
next file descriptor it opens, the epoll instance used for IRQs, then
becomes fd 0:

    [19 lines not shown]
DeltaFile
+12-4arch/um/kernel/time.c
+12-41 files

Linux/linux 1d7d3e3 — arch/um/drivers vector_kern.h vector_kern.c

um: vector: Don't clean up NAPI that was never set up

vector_net_open() calls vector_net_close() on any failure once
vp->fds is set, and vector_net_close() then runs napi_disable() and
netif_napi_del() unconditionally. But the NAPI context is only added
and enabled after build_transport_data() and the header buffer
allocations, so a failure in any of those disables a NAPI context that
was never added. napi_disable() locks n->dev, which is still NULL:

  ip link set vec0 up   (vec0:transport=gre,...,rx_key=1, no tx_key)
  Kernel panic - not syncing: Kernel mode fault at addr 0x910
   napi_disable+0x4e/0x9e
   vector_net_close+0x2b9/0x87d
   vector_net_open+0x105d/0x106f
   __dev_open+0x244/0x334

Record in vp->napi_enabled whether vector_net_open() got as far as
enabling NAPI, and only disable and delete it in vector_net_close()
when it did. NAPI is still enabled only after the queues and buffers

    [10 lines not shown]
DeltaFile
+7-2arch/um/drivers/vector_kern.c
+1-0arch/um/drivers/vector_kern.h
+8-22 files

Linux/linux 0df8958 — drivers/mmc/core core.c sdio_bus.c, drivers/mmc/host mmci_stm32_sdmmc.c sdhci-pci-gli.c

Merge tag 'mmc-v7.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
 "MMC core:
   - Saturate erase timeout instead of overflowing
   - Use GFP_NOIO for SD cache flush buffers
   - Fix probing of SDIO functions on ACPI systems
   - Mark the end of a truncated scatterlist
   - Clear MQRQ_XFER_SINGLE_BLOCK for new requests
   - Add ISSI IS22TF128G eMMC to fixed secure erase time quirk

  MMC host:
   - bcm2835: Restore scatterlist after DMA setup failure
   - dw_mmc:
      - Fix support for clk-phase in DT
      - Fix races at remove
   - mmci:
      - Fix support for tuning for stm32
      - Do not count a data CRC error as a complete transfer

    [36 lines not shown]
DeltaFile
+41-50drivers/mmc/host/sh_mmcif.c
+61-2drivers/mmc/host/mmci.c
+28-1drivers/mmc/host/sdhci-pci-gli.c
+22-6drivers/mmc/host/mmci_stm32_sdmmc.c
+23-1drivers/mmc/core/sdio_bus.c
+14-5drivers/mmc/core/core.c
+189-6516 files not shown
+252-8822 files

Linux/linux 305f5f7 — Documentation/security/keys core.rst, security/keys internal.h keyctl.c

Merge tag 'keys-v7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd

Pull key fixes from Jarkko Sakkinen:

 - Synchronize key_instantiate_and_link() and key_reject_and_link() with
   unregister_key_type() using SRCU, so that a concurrent type removal
   does not fail on null deref

 - Call rcu_barrier() at module exit so that encrypted_rcu_free() and
   trusted_rcu_free() callbacks queued by ->update() cannot run in freed
   module memory

 - Return user_session directly instead of installing it into the task's
   credentials on a lookup without KEY_LOOKUP_CREATE, as mutating struct
   cred, as client subsystem will then end up having a stale struct cred

 - Reject KEY_LOOKUP_CREATE with -EPERM when the task runs with
   overridden credentials, instead of triggering BUG_ON() in
   commit_creds()

    [7 lines not shown]
DeltaFile
+114-46security/keys/key.c
+16-36security/keys/process_keys.c
+13-0security/keys/gc.c
+5-2Documentation/security/keys/core.rst
+2-3security/keys/keyctl.c
+2-0security/keys/internal.h
+152-872 files not shown
+154-878 files

Linux/linux 3f96369 — drivers/media/common/videobuf2 videobuf2-core.c, drivers/media/pci/intel/ipu6 ipu6-isys-csi2.c ipu6-isys.c

Merge tag 'media/v7.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

 - two videobuf2 core fixes related to finish prepared buffers on mmap
   lock and at VIDIOC_REMOVE_BUFS ioctl

 - Intel iPU6:
    - fix image height calculus
    - address a race contition at ipu6-isys-video
    - fix a return condition and print an error at klog if frame
      descriptior is not found
    - Check if firmware is started before close on suspend

 - AMD ISP4:
    - fix API mmap dequeue of progressive-only framebuffers
    - fix bad lock issues affecting stream start logic

 - fix for ivsc csi driver, addressing an issue affecting camera

    [13 lines not shown]
DeltaFile
+103-51drivers/media/common/videobuf2/videobuf2-core.c
+10-5drivers/media/pci/intel/ivsc/mei_csi.c
+11-4drivers/media/platform/amd/isp4/isp4_subdev.c
+11-3drivers/media/pci/intel/ipu6/ipu6-isys.c
+6-4drivers/media/platform/amd/isp4/isp4_video.c
+6-2drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
+147-692 files not shown
+155-758 files

Linux/linux a4e3ddc — drivers/gpu/drm/i915 i915_vma.c i915_vma_types.h

Merge tag 'drm-fixes-2026-12-02' of https://gitlab.freedesktop.org/drm/kernel

Pull drm fix from Dave Airlie:
 "An out of band pull request for an i915 rcu fix that I want to get
  into stable, so let's just make it get there faster.

  i915:
   - use rcu to free vma"

* tag 'drm-fixes-2026-12-02' of https://gitlab.freedesktop.org/drm/kernel:
  i915/vma: use kfree_rcu to make sure vma are freed after a rcu grace period
DeltaFile
+3-0drivers/gpu/drm/i915/i915_vma_types.h
+1-1drivers/gpu/drm/i915/i915_vma.c
+4-12 files

Linux/linux 4cd3c5b — drivers/gpu/drm/i915 i915_vma.c i915_vma_types.h

i915/vma: use kfree_rcu to make sure vma are freed after a rcu grace period

There is a race in the vma lookup and the vma freeing that can race
object close against object execbuffer vma lookups.

execbuffer2 and close on two threads can be raced, so the radix tree
lookup and tryget in eb_lookup_vma can be raced against a freed vma.

The rcu protection in the eb lookup doesn't help because we don't
use rcu around the free path.

This patch adds rcu protection around the vma destruction path.

We could also probably use SLAB_TYPESAFE_BY_RCU but there may be
other submarined vma races in other code that this might not fix,
so let's just force the rcu on free.

Cc: stable at vger.kernel.org
Signed-off-by: Dave Airlie <airlied at redhat.com>
DeltaFile
+3-0drivers/gpu/drm/i915/i915_vma_types.h
+1-1drivers/gpu/drm/i915/i915_vma.c
+4-12 files

Linux/linux 693c2e0 — mm slub.c

mm: kvmalloc: Bail if called with soft or hard IRQs disabled

The function kvmalloc may call vmalloc under the hood even when
used with GFP_ATOMIC.  However, vmalloc uses naked spin locks so
it must not be called if the caller already holds spin locks that
can be used in hard or soft IRQ context.

Use the heuristic irqs_disabled() || in_softirq() to detect such
callers and prevent them from using vmalloc.

Reported-by: Liam R. Howlett (Google) <liam at infradead.org>
Fixes: c6307674ed82 ("mm: kvmalloc: add non-blocking support for vmalloc")
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
DeltaFile
+8-0mm/slub.c
+8-01 files

Linux/linux 1ec0c47 — drivers/cpuidle cpuidle-psci-domain.c, drivers/pmdomain core.c

Merge tag 'pmdomain-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm

Pull pmdomain fixes:
 "pmdomain core:
   - Wait for device link removals before dropping genpd->dev
   - Clear states after freeing them

  pmdomain providers:
   - Fix some memory leaks and reference countings during probe/remove
   - cpuidle-psci: Skip SET_SUSPEND_MODE when OSI is unsupported
   - mediatek:
      - Fix a couple problems in the probe error path
      - Fix silent audio from premature sync_state for mt8183
   - qcom: Don't clamp gfx and gmxc before sync_state for rpmhpd
   - rockchip:
      - Fix a couple problems in the probe error path
      - Manage the RK3576 GPU domain supply"

* tag 'pmdomain-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm:

    [16 lines not shown]
DeltaFile
+88-11drivers/pmdomain/rockchip/pm-domains.c
+47-23drivers/pmdomain/mediatek/mtk-pm-domains.c
+17-11drivers/pmdomain/imx/gpc.c
+6-4drivers/cpuidle/cpuidle-psci-domain.c
+9-0drivers/pmdomain/mediatek/mt8183-pm-domains.h
+7-1drivers/pmdomain/core.c
+174-505 files not shown
+184-5611 files

Linux/linux 6f459d7 — security security.c

Merge tag 'lsm-pr-20261130' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm

Pull lsm fix from Paul Moore:
 "A single fix for the LSM framework to ensure that the
  security_inode_copy_up() error handling code properly
  cleans up after itself"

* tag 'lsm-pr-20261130' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
  lsm: put the copy up creds when an LSM hook fails
DeltaFile
+11-3security/security.c
+11-31 files

Linux/linux f3d1ce2 — security/selinux hooks.c xfrm.c

Merge tag 'selinux-pr-20261130' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux

Pull selinux fixes from Paul Moore:
 "Two SELinux fixes: one tightens a size check in SELinux's labeled
  IPsec code, the other ensures that the source and destination port of
  network related SELinux audit denial records (commonly known as "AVC"
  records) are properly initialized"

* tag 'selinux-pr-20261130' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
  selinux: reject a 65535-byte xfrm context that ctx_len cannot hold
  selinux: initialize sport/dport in __ad_net_init()
DeltaFile
+2-1security/selinux/xfrm.c
+2-0security/selinux/hooks.c
+4-12 files

Linux/linux 19cc08c — drivers/clk/qcom gcc-glymur.c, drivers/clk/samsung clk-exynos5-subcmu.c clk-exynos-audss.c

Merge tag 'clk-fixes-for-linus-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clk fixes from Brian Masney:
 "Qualcomm Glymur GCC:

   - Use collapse voting for PCIe and PCIe PHY power domains shared with
     other masters, including domains enabled by boot firmware

   - Retain USB and USB PHY power domains to preserve configuration and
     fix USB host controller resume from suspend

  Samsung Exynos:

   - Properly handle deferred probe of the AudioSubsystem clock
     controller

   - Fix integration of clock controller and power domains on Exynos5250
     and Exynos5420: be sure device runtime resumed before proceeding
     with probe and defer probe till the power domain is available"

    [7 lines not shown]
DeltaFile
+36-10drivers/clk/qcom/gcc-glymur.c
+24-9drivers/clk/samsung/clk-exynos-audss.c
+23-4drivers/clk/samsung/clk-exynos5-subcmu.c
+83-233 files

Linux/linux 95c201c — arch/x86/include/asm uaccess.h, drivers/vhost scsi.c

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio fixes from Michael Tsirkin:
 "Just a bunch of small fixes all over the place. Nothing stands out
  much.

  A new test in tools - given we had a bunch of issues around logging
  discovered recently, seems prudent to just include it"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio: Release the OF node when unregistering the device
  vhost: synchronize worker freeing on vhost-net teardown
  tools/virtio: add a vhost dirty log test
  vhost: set dirty log bits without pinning pages on x86
  tools/virtio: vringh_test: check that a split ring must be a power of two
  virtio_ring: reject a split ring size that is not a power of two again
  virtio-pci: Drop inclusion of <linux/mod_devicetable.h>
  virtio_balloon: drain update works on probe error paths
  virtio_console: defer HVC polling out of the virtqueue callback

    [7 lines not shown]
DeltaFile
+432-0tools/virtio/vhost_log_test.c
+61-0tools/virtio/vhost_log_test.rst
+35-15drivers/vhost/scsi.c
+23-0arch/x86/include/asm/uaccess.h
+17-5drivers/virtio/virtio_balloon.c
+14-5drivers/virtio/virtio_ring.c
+582-2520 files not shown
+657-5126 files

Linux/linux 65cf6d5 — drivers/clk/qcom gcc-glymur.c

Merge tag 'qcom-clk-fixes-for-7.4' into clk-fixes

Qualcomm clock fixes for v7.4

Fix Glymur GCC power domain handling for PCIe and USB.

- Use collapse voting for PCIe and PCIe PHY power domains shared with
  other masters, including domains enabled by boot firmware.
- Retain USB and USB PHY power domains to preserve configuration and
  fix USB host controller resume from suspend.

* tag 'qcom-clk-fixes-for-7.4':
  clk: qcom: gcc-glymur: use collapse-voting for PCIe GDSCs
  clk: qcom: gcc-glymur: Use PWRSTS_RET_ON flag for USB GDSCs
DeltaFile
+36-10drivers/clk/qcom/gcc-glymur.c
+36-101 files

Linux/linux 428260d — drivers/mmc/host bcm2835.c

mmc: bcm2835: restore scatterlist after DMA setup failure

The DMA preparation path shortens the final scatterlist entry
to reserve space for FIFO drain words.

If DMA mapping or descriptor preparation fails, the request
falls back to PIO, but the shortened scatterlist entry is left
unchanged. As a result, the PIO transfer may omit part of the
data, potentially causing corrupted or incomplete I/O.

Restore the entry's original length and clear drain_words
before returning to the fallback path.

This issue was found while investigating a kernel panic on
my Raspberry Pi server.

Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.")
Cc: stable at vger.kernel.org
Signed-off-by: Artem Novak <artem122novak at gmail.com>

    [2 lines not shown]
DeltaFile
+12-1drivers/mmc/host/bcm2835.c
+12-11 files

Linux/linux b717540 — drivers/mmc/host rtsx_usb_sdmmc.c

mmc: rtsx_usb_sdmmc: allow legacy SD init after CMD8 timeout

According to the rts5139 staging driver, SD 1.x cards do not respond
to SD_SEND_IF_COND. On an RTS5129, a preinserted 2 GB SD card times
out on that command and the driver then rejects CMD55 and subsequent
initialization requests with -ENOMEDIUM. This prevents MMC core from
trying the legacy SD path.

Do not suppress card detection on a timeout from a no-data CMD8.
MMC SEND_EXT_CSD uses the same opcode with a data transfer, so retain
the existing timeout handling for that command. Keep refreshing the
physical card state and retain suppression on other discovery timeouts
to stop repeated probes of an empty tray.

Fixes: 7185b6d33b17 ("mmc: rtsx_usb_sdmmc: suppress false CD after init timeout")
Cc: stable at vger.kernel.org
Reported-by: Philipp Jonas <pjjonas at web.de>
Closes: https://lore.kernel.org/r/523eb7d1cc0811df4a5e4c534538f3dd@web.de
Tested-by: Philipp Jonas <pjjonas at web.de>

    [2 lines not shown]
DeltaFile
+5-3drivers/mmc/host/rtsx_usb_sdmmc.c
+5-31 files

Linux/linux c74d1bd — tools/virtio .gitignore Makefile

tools/virtio: add a vhost dirty log test

Add vhost_log_test, which exercises used-ring dirty logging through the
existing vhost_test module. It sets a log base with VHOST_SET_LOG_BASE,
enables VHOST_VRING_F_LOG on the ring, submits descriptors and checks
the resulting bitmap from userspace. No new kernel interface is needed.

The test covers:

 - every bit in a byte, repeated sets, and neighbouring bytes being left
   untouched, including the last byte of a page followed by a PROT_NONE
   guard page
 - a used ring write that spans two log pages, with both bits in the
   same bitmap byte and in adjacent bytes
 - a log page that has not been faulted in yet, read-only, PROT_NONE
   and unmapped log pages, and logging after access is restored
 - private (COW) and shared file mappings, checking that the bit reaches
   the file after msync/fsync
 - eight vrings setting different bits of the same byte concurrently,

    [17 lines not shown]
DeltaFile
+432-0tools/virtio/vhost_log_test.c
+61-0tools/virtio/vhost_log_test.rst
+5-2tools/virtio/Makefile
+1-0tools/virtio/.gitignore
+499-24 files

Linux/linux b31ad78 — drivers/virtio virtio.c

virtio: Release the OF node when unregistering the device

virtio_device_of_init() acquires the OF node reference once during device
registration. virtio_dev_remove() currently puts it on each driver unbind,
although rebinding the driver does not acquire a new reference. Repeated
unbinds can therefore consume references not owned by the virtio device.
Conversely, unregistering a device that never bound to a driver leaves
the reference held.

Move the put to unregister_virtio_device() so it is paired with device
registration. Save the node pointer before device_unregister(), which
can free the virtio device, and put it after unregister has completed the
driver removal.

Fixes: 694a1116b405 ("virtio: Bind virtio device to device-tree node")
Reported-by: sashiko-bot <sashiko-bot at kernel.org>
Link: https://lore.kernel.org/all/sashiko-outbox-203883@kernel.org/
Cc: stable at vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86 at gmail.com>

    [2 lines not shown]
DeltaFile
+2-2drivers/virtio/virtio.c
+2-21 files

Linux/linux 803b45f — drivers/vhost net.c

vhost: synchronize worker freeing on vhost-net teardown

vhost_workers_free() only waits for RCU readers when sync is true.  Both
vhost-net teardown paths pass false, relying on the assumption recorded
when the sync parameter was introduced (5efd97e6f0c7) that "net and scsi
stop their virtqueues before the workers are freed".

That assumption does not hold when a tap queue is detached while the
socket is still attached.  __tun_detach() runs tun_queue_purge() on the
detaching thread, so skb_queue_purge() releases the zerocopy skbs and
vhost_zerocopy_complete() -> vhost_poll_queue() runs there rather than on
the vhost worker.  The vhost_dev_flush() calls in vhost_net_flush() and
vhost_dev_stop() only wait for the vhost workers, so the queueing can
still be in flight when vhost_dev_cleanup() frees the worker, and
vhost_worker_queue() then dereferences freed memory.

Pass sync=true from vhost_net_release() and vhost_net_reset_owner() so a
grace period and a flush are observed before the workers are released,
matching the vsock RESET_OWNER path.  Both are slow paths, and the extra

    [17 lines not shown]
DeltaFile
+2-2drivers/vhost/net.c
+2-21 files

Linux/linux d52fc0d — arch/x86/include/asm uaccess.h, drivers/vhost vhost.c

vhost: set dirty log bits without pinning pages on x86

vhost had a TODO to replace page pinning with a version
of set_bit that works on userspace memory, since forever.

It is really best to avoid GUP on fast path entirely.
Implement set_bit_user and use it in vhost, to do just that.

Should not be too hard for non-x86 too.

Reported-by: Khan Zhao <zhaoguohan at kylinos.cn>
Link: https://lore.kernel.org/all/20261112085631.128819-1-zhaoguohan@kylinos.cn/
Signed-off-by: Khan Zhao <zhaoguohan at kylinos.cn>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
Message-ID: <20261117083323.89502-2-zhaoguohan at kylinos.cn>
DeltaFile
+23-0arch/x86/include/asm/uaccess.h
+7-0drivers/vhost/vhost.c
+30-02 files

Linux/linux 11b75af — tools/virtio vringh_test.c

tools/virtio: vringh_test: check that a split ring must be a power of two

vring_new_virtqueue() used to accept a split ring of any size, although
the ring is indexed with num - 1 as a mask. Check that it now refuses
one size short of RINGSIZE.

Without the preceding fix, vringh_test fails with:

  vringh_test: vring_new_virtqueue accepted size 255

With it, vring_new_virtqueue() prints:

  Bad virtqueue length 255 (not a power of two)

and the rest of the test runs as before.

Signed-off-by: Stjepan Poljak <stjepan.poljak at gmail.com>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
Message-ID: <20261112154927.4004184-3-stjepan.poljak at gmail.com>
DeltaFile
+11-0tools/virtio/vringh_test.c
+11-01 files

Linux/linux 2449b91 — drivers/virtio virtio_ring.c

virtio_ring: reject a split ring size that is not a power of two again

The split ring indexes its avail and used rings with num - 1 as a mask,
so its size must be a power of two. Commit 2a2d1382fe9d ("virtio: Add
improved queue allocation API") moved that check from
vring_new_virtqueue() into the new allocation path, which
vring_new_virtqueue() does not use.

remoteproc calls vring_new_virtqueue() with a ring size from the
firmware, checked only to be non-zero. With 100 entries, for example,
the driver would put buffers 4 and 8 in avail slot 0. The device would
look for them at slots 4 and 8, possibly reading the wrong data.

Put the check back for the split ring; the packed ring has no such
restriction.

Fixes: 2a2d1382fe9d ("virtio: Add improved queue allocation API")
Signed-off-by: Stjepan Poljak <stjepan.poljak at gmail.com>
Reviewed-by: Francesco Valla <francesco at valla.it>

    [4 lines not shown]
DeltaFile
+7-0drivers/virtio/virtio_ring.c
+7-01 files

Linux/linux 9a818e7 — include/linux virtio_pci_legacy.h

virtio-pci: Drop inclusion of <linux/mod_devicetable.h>

Among the different device id structures <linux/virtio_pci_legacy.h>
only uses struct virtio_device_id. Include <linux/device-id/virtio.h>
instead of <linux/mod_devicetable.h> to provide that which is more
lightweight and doesn't introduce that many dependencies.

The users of <linux/virtio_pci_legacy.h> also don't rely on this header
to provide the full plethora of definitions. (There are only
drivers/vdpa/alibaba/eni_vdpa.c and drivers/virtio/virtio_pci_common.c
using pci_device_id and these include <linux/pci.h> which is enough to
get it.)

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig at baylibre.com>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
Message-ID: <fc69191474ffd49d50d7e39b13dfe6586f4d3f75.1783354857.git.u.kleine-koenig at baylibre.com>
DeltaFile
+1-1include/linux/virtio_pci_legacy.h
+1-11 files

Linux/linux d372d20 — drivers/mmc/host sh_mmcif.c

mmc: sh_mmcif: rework sg_miter handling

This driver is the only one that uses sg_miter_next() to get a persistent
mapping across interrupts, which prevents us from converting the internal
kmap() to a local mapping using SG_MITER_LOCAL flag.

Linus previously attempted to use atomic mappings here, which failed
for the same reason. I gave it another try, with a mapping that is only
active during a single sh_mmcif_mread_block()/sh_mmcif_mwrite_block() call.

This is mainly a revert of the patch that fixed the command 18 timeout,
but tries to solve the problem by updating and checking data->bytes_xfered
to keep track of when the transfer is finished.

Instead of calling sg_miter_stop() on error or completion, this now
always stops the iterator after the data transfer and restarts it during
the following interrupt.

As sashiko-bot comments, there is an inconsistency with the size of

    [15 lines not shown]
DeltaFile
+27-41drivers/mmc/host/sh_mmcif.c
+27-411 files

Linux/linux c6e5942 — drivers/mmc/core sd.c

mmc: core: use GFP_NOIO for SD cache flush buffers

sd_flush_cache() is called from mmc_blk_mq_issue_rq()'s REQ_OP_FLUSH
branch, which runs in the block layer dispatch path with the queue usage
counter held.  Both it and sd_write_ext_reg(), which it calls, allocate
a 512-byte buffer with GFP_KERNEL.  Under memory pressure that
allocation enters filesystem reclaim, and reclaim may submit I/O back to
the same request queue, closing a cycle against queue freeze:

      CPU0                              CPU1
      ----                              ----
  lock(&q->q_usage_counter(io));
                              lock(fs_reclaim);
                              lock(&q->q_usage_counter(io));
  lock(&q->elevator_lock);

lockdep reports it on an arm64 Raspberry Pi 5 that boots from an SD
card, with the flush dispatched by blk_mq_requeue_work and the elevator
switch in another thread:

    [31 lines not shown]
DeltaFile
+2-2drivers/mmc/core/sd.c
+2-21 files

Linux/linux eb9a646 — drivers/mmc/core mmc_test.c

mmc: mmc_test: Set "cnt" to the allocated size explicitly

Since commit c35fac6481a1d ("mmc: mmc_test: Fix __counted_by handling
after kzalloc_flex() conversion"), mmc_test_alloc_mem() bounds its fill
loop with mem->cnt, relying on kzalloc_flex() to have set it to
"max_segs". kzalloc_flex() only sets the __counted_by() counter when the
compiler supports __builtin_counted_by_ref(). Otherwise mem->cnt is still
zero after the first segment is stored.

Set mem->cnt after the allocation, as that commit's description intends.

Build tested ARCH=x86_64 defconfig with CONFIG_MMC_TEST=m and W=1, with
GCC 16.2.0.

Fixes: c35fac6481a1d ("mmc: mmc_test: Fix __counted_by handling after kzalloc_flex() conversion")
Cc: stable at vger.kernel.org
Signed-off-by: Kees Cook <kees at kernel.org>
Reviewed-by: Adrian Hunter <adrian.hunter at intel.com>
Signed-off-by: Ulf Hansson <ulfh at kernel.org>
DeltaFile
+1-0drivers/mmc/core/mmc_test.c
+1-01 files