* [PATCH][next] drm/msm: Fix dereference of pointer minor before null check
@ 2025-07-30 14:29 Colin Ian King
2025-07-30 16:30 ` [PATCH] " Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-07-30 14:29 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
linux-arm-msm, dri-devel, freedreno
Cc: kernel-janitors, linux-kernel
Currently the pointer minor is being dereferenced before it is null
checked, leading to a potential null pointer dereference issue. Fix this
by dereferencing the pointer only after it has been null checked. Also
Replace minor->dev with dev.
Fixes: 4f89cf40d01e ("drm/msm: bail out late_init_minor() if it is not a GPU device")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/gpu/drm/msm/msm_debugfs.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c
index bbda865addae..97dc70876442 100644
--- a/drivers/gpu/drm/msm/msm_debugfs.c
+++ b/drivers/gpu/drm/msm/msm_debugfs.c
@@ -325,25 +325,28 @@ static struct drm_info_list msm_debugfs_list[] = {
static int late_init_minor(struct drm_minor *minor)
{
- struct drm_device *dev = minor->dev;
- struct msm_drm_private *priv = dev->dev_private;
+ struct drm_device *dev;
+ struct msm_drm_private *priv;
int ret;
if (!minor)
return 0;
+ dev = minor->dev;
+ priv = dev->dev_private;
+
if (!priv->gpu_pdev)
return 0;
ret = msm_rd_debugfs_init(minor);
if (ret) {
- DRM_DEV_ERROR(minor->dev->dev, "could not install rd debugfs\n");
+ DRM_DEV_ERROR(dev->dev, "could not install rd debugfs\n");
return ret;
}
ret = msm_perf_debugfs_init(minor);
if (ret) {
- DRM_DEV_ERROR(minor->dev->dev, "could not install perf debugfs\n");
+ DRM_DEV_ERROR(dev->dev, "could not install perf debugfs\n");
return ret;
}
--
2.50.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] drm/msm: Fix dereference of pointer minor before null check
2025-07-30 14:29 [PATCH][next] drm/msm: Fix dereference of pointer minor before null check Colin Ian King
@ 2025-07-30 16:30 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-07-30 16:30 UTC (permalink / raw)
To: Colin Ian King, dri-devel, freedreno, kernel-janitors,
linux-arm-msm, Abhinav Kumar, David Airlie, Dmitry Baryshkov,
Jessica Zhang, Marijn Suijten, Rob Clark, Sean Paul,
Simona Vetter
Cc: LKML
…
> by dereferencing the pointer only after it has been null checked. Also
> Replace minor->dev with dev.
I suggest to separate desirable changes into another patch series.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.16#n81
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-30 16:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-30 14:29 [PATCH][next] drm/msm: Fix dereference of pointer minor before null check Colin Ian King
2025-07-30 16:30 ` [PATCH] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®