From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Rob Clark <rob.clark@oss.qualcomm.com>
Cc: Sean Paul <sean@poorly.run>,
Konrad Dybcio <konradybcio@kernel.org>,
Akhil P Oommen <akhilpo@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/msm/adreno: fix userspace-triggered crash on a2xx-a4xx
Date: Tue, 7 Apr 2026 02:43:16 +0300 [thread overview]
Message-ID: <5boflu67xgvflhrkbmc4gsv7dx3dzke5b324hudnrtt5kzn5wn@74e4t7doa2zg> (raw)
In-Reply-To: <CACSVV03uVF-STTwCVR3=9Jf=dCh7buBmk-1LBhYO0YfUDYXNDQ@mail.gmail.com>
On Mon, Apr 06, 2026 at 03:24:43PM -0700, Rob Clark wrote:
> On Mon, Apr 6, 2026 at 3:14 PM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >
> > Before a5xx Adreno driver will not try fetching UBWC params (because
> > those generations didn't support UBWC anyway), however it's still
> > possible to query UBWC-related params from the userspace, triggering
> > possible NULL pointer dereference. Check for UBWC config in
> > adreno_get_param() and return sane defaults if there is none.
> >
> > Fixes: a452510aad53 ("drm/msm/adreno: Switch to the common UBWC config struct")
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > ---
> > drivers/gpu/drm/msm/adreno/adreno_gpu.c | 15 ++++++++++++---
> > 1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> > index d5fe6f6f0dec..7dc95c0a17f7 100644
> > --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> > +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> > @@ -426,16 +426,25 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_context *ctx,
> > *value = vm->mm_range;
> > return 0;
> > case MSM_PARAM_HIGHEST_BANK_BIT:
> > - *value = adreno_gpu->ubwc_config->highest_bank_bit;
> > + if (!adreno_gpu->ubwc_config)
> > + *value = 13;
> > + else
> > + *value = adreno_gpu->ubwc_config->highest_bank_bit;
>
> These three params are only used by userspace on a6xx, so tbh it would
> be ok to return -ENOENT for platforms that have no ubwc config. That
> might be better than returning imaginary values.
I'd say, those are defaults. But I agree, -ENOENT might be better.
>
> BR,
> -R
>
> > return 0;
> > case MSM_PARAM_RAYTRACING:
> > *value = adreno_gpu->has_ray_tracing;
> > return 0;
> > case MSM_PARAM_UBWC_SWIZZLE:
> > - *value = adreno_gpu->ubwc_config->ubwc_swizzle;
> > + if (!adreno_gpu->ubwc_config)
> > + *value = 0;
> > + else
> > + *value = adreno_gpu->ubwc_config->ubwc_swizzle;
> > return 0;
> > case MSM_PARAM_MACROTILE_MODE:
> > - *value = adreno_gpu->ubwc_config->macrotile_mode;
> > + if (!adreno_gpu->ubwc_config)
> > + *value = 0;
> > + else
> > + *value = adreno_gpu->ubwc_config->macrotile_mode;
> > return 0;
> > case MSM_PARAM_UCHE_TRAP_BASE:
> > *value = adreno_gpu->uche_trap_base;
> >
> > ---
> > base-commit: 36ece9697e89016181e5ae87510e40fb31d86f2b
> > change-id: 20260407-adreno-fix-ubwc-6a2564710e21
> >
> > Best regards,
> > --
> > With best wishes
> > Dmitry
> >
--
With best wishes
Dmitry
next prev parent reply other threads:[~2026-04-06 23:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-06 22:14 [PATCH] drm/msm/adreno: fix userspace-triggered crash on a2xx-a4xx Dmitry Baryshkov
2026-04-06 22:24 ` Rob Clark
2026-04-06 23:43 ` Dmitry Baryshkov [this message]
2026-04-12 4:17 ` Claude review: " Claude Code Review Bot
2026-04-12 4:17 ` Claude Code Review Bot
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=5boflu67xgvflhrkbmc4gsv7dx3dzke5b324hudnrtt5kzn5wn@74e4t7doa2zg \
--to=dmitry.baryshkov@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=akhilpo@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=rob.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox