From: sashiko-bot@kernel.org
To: "Yuanjie Yang" <yuanjie.yang@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers on destroy
Date: Mon, 30 Nov 2026 07:06:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-240549@kernel.org> (raw)
In-Reply-To: <20261130-dpu_unbind_rebind_display-v1-6-c335387de1bb@oss.qualcomm.com>
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: double free on gpu->memptrs_bo in msm_gpu_init()
[1]
--
commit f46993f14cc108abd1489c5015e179df0efd70e6
Author: Yuanjie Yang <yuanjie.yang@oss.qualcomm.com>
drm/msm/a6xx: free the preemption and pwrup_reglist buffers on destroy
This commit releases all preemption buffers in a6xx_preempt_fini() while
clearing their pointers, and calls a6xx_preempt_fini() alongside freeing
pwrup_reglist_bo in a6xx_destroy().
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
> index df8d4f3e8d4c1..821c04bfed00b 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_preempt.c
> @@ -354,8 +354,15 @@ void a6xx_preempt_fini(struct msm_gpu *gpu)
> struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
> int i;
>
> - for (i = 0; i < gpu->nr_rings; i++)
> + for (i = 0; i < gpu->nr_rings; i++) {
> msm_gem_kernel_put(a6xx_gpu->preempt_bo[i], gpu->vm);
> + a6xx_gpu->preempt_bo[i] = NULL;
> + msm_gem_kernel_put(a6xx_gpu->preempt_smmu_bo[i], gpu->vm);
> + a6xx_gpu->preempt_smmu_bo[i] = NULL;
> + }
> +
> + msm_gem_kernel_put(a6xx_gpu->preempt_postamble_bo, gpu->vm);
> + a6xx_gpu->preempt_postamble_bo = NULL;
> }
>
> void a6xx_preempt_init(struct msm_gpu *gpu)
[Severity: Critical]
This problem wasn't introduced by this patch, but can gpu->memptrs_bo be
double freed [1] if msm_gpu_init() fails after allocating it?
drivers/gpu/drm/msm/msm_gpu.c:msm_gpu_init() {
...
fail:
for (i = 0; i < ARRAY_SIZE(gpu->rb); i++) {
msm_ringbuffer_destroy(gpu->rb[i]);
gpu->rb[i] = NULL;
}
msm_gem_kernel_put(gpu->memptrs_bo, gpu->vm);
platform_set_drvdata(pdev, NULL);
return ret;
}
When a step such as msm_ringbuffer_new() fails, msm_gpu_init() releases
gpu->memptrs_bo without clearing the pointer to NULL. The caller's error
path (for example a6xx_gpu_init() -> a6xx_destroy() -> adreno_gpu_cleanup()
-> msm_gpu_cleanup()) then calls msm_gem_kernel_put(gpu->memptrs_bo,
gpu->vm) a second time on the already-freed GEM object.
[1] https://sashiko.dev/#/bug/linux-ee423138-c527-467c-b053-bdbec97b4f9c
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-dpu_unbind_rebind_display-v1-0-c335387de1bb@oss.qualcomm.com?part=6
next prev parent reply other threads:[~2026-11-30 7:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 6:55 [PATCH 0/9] drm/msm: fix unbind/rebind of the msm_dpu Yuanjie Yang
2026-11-30 6:55 ` [PATCH 1/9] drm/msm/dpu: clean up the self-refresh helper on KMS teardown Yuanjie Yang
2026-11-30 6:55 ` [PATCH 2/9] drm/msm/dp: don't depopulate the eDP AUX bus on component unbind Yuanjie Yang
2026-11-30 7:09 ` sashiko-bot
2026-11-30 9:54 ` yuanjiey
2026-11-30 6:55 ` [PATCH 3/9] drm/msm: unpin the fbdev buffer when the fbdev is destroyed Yuanjie Yang
2026-11-30 6:55 ` [PATCH 4/9] drm/msm/a6xx: don't leak the SQE vmap in a6xx_ucode_check_version() Yuanjie Yang
2026-11-30 8:00 ` Konrad Dybcio
2026-11-30 6:55 ` [PATCH 5/9] drm/msm/a6xx: drop the shadow BO vmap on destroy Yuanjie Yang
2026-11-30 8:04 ` Konrad Dybcio
2026-11-30 6:55 ` [PATCH 6/9] drm/msm/a6xx: free the preemption and pwrup_reglist buffers " Yuanjie Yang
2026-11-30 7:06 ` sashiko-bot [this message]
2026-11-30 6:55 ` [PATCH 7/9] drm/msm/a6xx: map the GMU rscc and PDC regions against the GPU device Yuanjie Yang
2026-11-30 7:07 ` sashiko-bot
2026-11-30 8:29 ` Konrad Dybcio
2026-11-30 9:56 ` yuanjiey
2026-11-30 6:55 ` [PATCH 8/9] drm/msm/a6xx: cold boot the GMU on the first resume after bind Yuanjie Yang
2026-11-30 6:55 ` [PATCH 9/9] drm/msm/a6xx: wake up a PDC left asleep by a previous GPU instance Yuanjie Yang
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-240549@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yuanjie.yang@oss.qualcomm.com \
/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.