[PATCH v2 0/9] mmc: Use proper sg_miter for scatterlists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It was brought to our attention that some MMC host drivers
are referencing sg_virt(sg) directly on scatterlist entries,
which will not perform buffer bouncing for CONFIG_HIGHMEM
pages that reside in highmem.

See the following mail from Christoph and the discussion:
https://lore.kernel.org/linux-mmc/20240122073423.GA25859@xxxxxx/

This means that bugs with highmem pages can go unnoticed
until an actual highmem page is finally used and not bounced,
resulting in things like unpredictable file corruption.

Attempt to fix this by amending all host controllers
calling sg_virt() for PIO to instead do proper traversal
of the scatterlists using sg_miter helpers that will
kmap() the pages properly, possibly bouncing
it from highmem if need be.

All patches are compile-tested except the m68k one,
sdhci-esdhc-mcf.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
Changes in v2:
- Bite the bullet and just patch all drivers to use sg_miter
- Link to v1: https://lore.kernel.org/r/20240125-mmc-proper-kmap-v1-0-ba953c1ac3f9@xxxxxxxxxx

---
Linus Walleij (9):
      mmc: davinci_mmc: Use sg_miter for PIO
      mmc: moxart-mmc: Factor out moxart_use_dma() helper
      mmc: moxart-mmc: Fix accounting in DMA transfer
      mmc: moxart-mmc: Use sg_miter for PIO
      mmc: mvsdio: Use sg_miter for PIO
      mmc: mxcmmc: Use sg_miter for PIO
      mmc: omap: Use sg_miter for PIO
      mmc: sdhci-esdhc-mcf: Use sg_miter for swapping
      mmc: sh_mmcif: Use sg_miter for PIO

 drivers/mmc/host/davinci_mmc.c     |  61 ++++++++++------------
 drivers/mmc/host/moxart-mmc.c      |  90 ++++++++++++++++----------------
 drivers/mmc/host/mvsdio.c          |  71 +++++++++++++++++++-------
 drivers/mmc/host/mxcmmc.c          |  53 +++++++++++--------
 drivers/mmc/host/omap.c            |  53 +++++++++----------
 drivers/mmc/host/sdhci-esdhc-mcf.c |  12 +++--
 drivers/mmc/host/sh_mmcif.c        | 102 +++++++++++++++++++++++--------------
 7 files changed, 251 insertions(+), 191 deletions(-)
---
base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
change-id: 20240125-mmc-proper-kmap-f2d4cf5d1756

Best regards,
-- 
Linus Walleij <linus.walleij@xxxxxxxxxx>





[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux