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.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
+5-3include/media/videobuf2-core.h
+146-702 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

Linux/linux 2985af2 — drivers/mmc/host dw_mmc.c

mmc: dw_mmc: Read clk-phase DT settings earlier

With a kernel 7.3.3 we saw the following on a SoCFPGA (Cyclone 5) based
board during initialization when using a high-speed SD-card:

  dw_mmc ff704000.mmc: DW MMC controller at irq 53,32 bit host data width,1024 deep fifo
  dw_mmc ff704000.mmc: Got CD GPIO
  dw_mmc ff704000.mmc: Got WP GPIO
  mmc_host mmc0: Bus speed = 50000000Hz (req 400000Hz, actual 396825HZ div = 63)
  mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
  mmc0: error -110 whilst initialising SD card
  mmc_host mmc0: Bus speed = 50000000Hz (req 300000Hz, actual 297619HZ div = 84)
  mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
  mmc0: error -110 whilst initialising SD card
  mmc_host mmc0: Bus speed = 50000000Hz (req 200000Hz, actual 200000HZ div = 125)
  mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
  mmc0: error -110 whilst initialising SD card
  mmc_host mmc0: Bus speed = 50000000Hz (req 100000Hz, actual 100000HZ div = 250)
  mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)

    [21 lines not shown]
DeltaFile
+2-2drivers/mmc/host/dw_mmc.c
+2-21 files

Linux/linux 4f34c36 — drivers/mmc/core core.c

mmc: core: saturate erase timeout instead of overflowing

With MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME, secure erase/trim requests
are no longer limited by max_discard, so mmc_mmc_erase_timeout() can be
called with a qty of several thousand erase groups. The timeout is then
computed as erase_timeout * sec_erase_mult * qty in 32-bit arithmetic.

With 512KiB erase groups the block layer limits a request to about 4096
groups, so the product overflows once ERASE_TIMEOUT_MULT * SEC_ERASE_MULT
exceeds about 3496. The wrapped value can be much shorter than the real
erase time, making the busy polling give up early with -ETIMEDOUT. No
card in the quirk list is known to reach that limit today.

Use check_mul_overflow() and saturate at UINT_MAX.

Cc: stable at vger.kernel.org
Signed-off-by: Michael Haener <michael.haener at siemens.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin at siemens.com>
Signed-off-by: Ulf Hansson <ulfh at kernel.org>
DeltaFile
+14-5drivers/mmc/core/core.c
+14-51 files

Linux/linux ae0bb9b — drivers/mmc/core card.h quirks.h

mmc: add ISSI IS22TF128G to fixed secure erase time quirk

The ISSI IS22TF128G eMMC (CID manfid 0x9d, oemid 0x0101, name "IS128G")
reports SECURE_REMOVAL_TYPE 0x01 (overwrite, then erase) and has a large
per-command overhead for secure erase. Secure erasing a 33.5GiB
partition with blkdiscard -s on an NXP i.MX8 (sdhci-esdhc-imx, HS400ES)
is split into max_discard sized requests of about 3.5MiB, i.e. roughly
10000 secure erase commands, which takes 5-7 hours once ~27GiB of the
partition have been written.

Since the per-command overhead dominates, apply
MMC_QUIRK_FIXED_SECURE_ERASE_TRIM_TIME so secure erase requests are no
longer limited by max_discard. With the quirk, secure erasing the same
partition with ~27GiB written takes about 6 minutes.

Card parameters: ERASE_GROUP_DEF 0x01, HC_ERASE_GRP_SIZE 0x01 (512KiB),
ERASE_TIMEOUT_MULT 0x12, SEC_ERASE_MULT 0x64, SEC_TRIM_MULT 0x64.

Cc: stable at vger.kernel.org

    [3 lines not shown]
DeltaFile
+9-0drivers/mmc/core/quirks.h
+1-0drivers/mmc/core/card.h
+10-02 files

Linux/linux b3aebfc — drivers/memstick/host rtsx_usb_ms.c

memstick: rtsx_usb_ms: disable poll_card work on removal

rtsx_usb_ms_drv_remove() sets host->eject and cancels poll_card, but a
concurrent rtsx_usb_ms_set_param() that already read eject as false
can queue the work after the cancel. Its callers, memstick_check() and
ms_block error recovery, are stopped only by the later
memstick_remove_host(). The delayed work can therefore run after
memstick_free_host() frees the host.

Use disable_delayed_work_sync() to drain the work and reject later
queueing. Probe initializes fresh work on rebind.

Found by a static analysis tool under development.

Fixes: 4676741a3464 ("memstick: rtsx_usb_ms: Fix slab-use-after-free in rtsx_usb_ms_drv_remove")
Cc: stable at vger.kernel.org # v6.10+
Co-developed-by: Ijae Kim <ae878000 at gmail.com>
Signed-off-by: Ijae Kim <ae878000 at gmail.com>
Signed-off-by: Myeonghun Pak <mhun512 at gmail.com>
Signed-off-by: Ulf Hansson <ulfh at kernel.org>
DeltaFile
+1-1drivers/memstick/host/rtsx_usb_ms.c
+1-11 files

Linux/linux 3552d12 — drivers/memstick/host r592.c

memstick: r592: shut down the detect timer on removal

r592_remove() deletes detect_timer before freeing the interrupt.
A card insertion or removal interrupt can re-arm it in between,
allowing r592_detect_timer() to access unmapped registers and queue
media_checker work on the freed host.

Use timer_shutdown_sync() to wait for the callback and prevent
re-arming. Keep timer_delete_sync() in r592_suspend(), since the
timer is needed again after resume.

Found by a static analysis tool under development.

Fixes: 632644227850 ("memstick: r592: Fix UAF bug in r592_remove due to race condition")
Cc: stable at vger.kernel.org
Co-developed-by: Ijae Kim <ae878000 at gmail.com>
Signed-off-by: Ijae Kim <ae878000 at gmail.com>
Signed-off-by: Myeonghun Pak <mhun512 at gmail.com>
Signed-off-by: Ulf Hansson <ulfh at kernel.org>
DeltaFile
+1-1drivers/memstick/host/r592.c
+1-11 files

Linux/linux ff5b4de — drivers/memstick/core memstick.c

memstick: core: Remove the host ID after device_del()

memstick_remove_host() removes the host ID from memstick_host_idr
before device_del() removes the "memstick<N>" device. A host added in
between, for example by another card reader being probed, can get the
same ID, and its device_add() fails:

  sysfs: cannot create duplicate filename '/class/memstick_host/memstick0'

Remove the ID after device_del(), as the error path of
memstick_add_host() already does.

Fixes: baf8532a147d ("memstick: initial commit for Sony MemoryStick support")
Cc: stable at vger.kernel.org
Signed-off-by: Changyul Lee <lcy8047 at gmail.com>
Signed-off-by: Ulf Hansson <ulfh at kernel.org>
DeltaFile
+1-1drivers/memstick/core/memstick.c
+1-11 files