Re: [PATCH] mmc: sdhci: unmap the bounce buffer before device release

Linus Walleij <[email protected]> Mon, 27 Jul 2026 16:16:14 +0200
Newsgroups org.kernel.vger.linux-mmc,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CAD++jLn7z2uSvn11KTi2WxdUD4SXno9rj7p4N3tfGgL2kjJ8qg@mail.gmail.com>
On Mon, Jul 27, 2026 at 4:11=E2=80=AFPM Myeonghun Pak <[email protected]> w=
rote:

> sdhci_allocate_bounce_buffer() allocates its buffer with devm_kmalloc()
> but maps it with dma_map_single(). The buffer is therefore released by
> devres without the streaming DMA mapping being unmapped.
>
> Register a managed action after dma_map_single() succeeds so the mapping
> is removed before devres releases the buffer. The action is registered
> only for buffers allocated and mapped by the SDHCI core, leaving buffers
> provided by host drivers under their existing ownership.
>
> Fixes: bd9b902798ab ("mmc: sdhci: Implement an SDHCI-specific bounce buff=
er")
> Cc: [email protected]
> Co-developed-by: Ijae Kim <[email protected]>
> Signed-off-by: Ijae Kim <[email protected]>
> Signed-off-by: Myeonghun Pak <[email protected]>

LGTM:
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij