From: sashiko-bot@kernel.org
To: "Michael McAllister" <me@michaelmcallister.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/msm/dsi: avoid pinning the command buffer on every transfer
Date: Mon, 09 Nov 2026 12:40:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-204968@kernel.org> (raw)
In-Reply-To: <179422752570.88190.13452031230666113805.msm-dsi-pin-leak@michaelmcallister.org>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/msm/dsi: double free in msm_dsi_tx_buf_free() [1]
--
commit da2da22a4a147766651afbdf0137d05a0c119858
Author: Michael McAllister <me@michaelmcallister.org>
drm/msm/dsi: avoid pinning the command buffer on every transfer
This commit replaces msm_gem_get_and_pin_iova() with msm_gem_get_iova() in
dsi_dma_base_get_6g() so that fetching the DSI command buffer's DMA address
does not take an additional pin on every transfer.
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index d92659d80f172..64fc54dff4839 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -1428,7 +1428,8 @@ int dsi_dma_base_get_6g(struct msm_dsi_host *msm_host, uint64_t *dma_base)
> if (!dma_base)
> return -EINVAL;
>
> - return msm_gem_get_and_pin_iova(msm_host->tx_gem_obj,
> + /* The command buffer stays pinned from allocation until teardown. */
> + return msm_gem_get_iova(msm_host->tx_gem_obj,
> priv->kms->vm, dma_base);
> }
[Severity: Critical]
This problem wasn't introduced by this patch, but can msm_dsi_tx_buf_free()
double free msm_host->tx_buf across component unbind cycles [1]?
drivers/gpu/drm/msm/dsi/dsi_host.c:msm_dsi_tx_buf_free() {
...
if (msm_host->tx_gem_obj) {
msm_gem_kernel_put(msm_host->tx_gem_obj, msm_host->vm);
drm_gpuvm_put(msm_host->vm);
msm_host->tx_gem_obj = NULL;
msm_host->vm = NULL;
}
if (msm_host->tx_buf)
dma_free_coherent(dev->dev, msm_host->tx_size, msm_host->tx_buf,
msm_host->tx_buf_paddr);
}
msm_host persists across component bind and unbind cycles, and unlike
msm_host->tx_gem_obj, msm_host->tx_buf is not cleared after
dma_free_coherent(). If a later bind fails before reallocating the buffer,
the resulting unbind calls dma_free_coherent() on the stale msm_host->tx_buf
pointer a second time.
[1] https://sashiko.dev/#/bug/linux-6f5085d3-ef49-482c-86e4-a2438bc1b91f
--
Sashiko AI review · https://sashiko.dev/#/patchset/179422752570.88190.13452031230666113805.msm-dsi-pin-leak@michaelmcallister.org?part=1
next prev parent reply other threads:[~2026-11-09 12:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 12:32 [PATCH] drm/msm/dsi: avoid pinning the command buffer on every transfer Michael McAllister
2026-11-09 12:40 ` sashiko-bot [this message]
2026-11-11 15:40 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-204968@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=me@michaelmcallister.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.