From: "Maíra Canal" <mcanal@igalia.com>
To: Gregor Herburger <gregor.herburger@linutronix.de>,
Maxime Ripard <mripard@kernel.org>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Douglas Anderson <dianders@chromium.org>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/vc4: hvs/v3d: Fix null dereference in unbind
Date: Tue, 21 Jul 2026 09:28:51 -0300 [thread overview]
Message-ID: <b1a84b2e-1f34-469f-898c-1dfb76efe2df@igalia.com> (raw)
In-Reply-To: <20260720-rpi-vc4-fix-v1-1-6073a96a5773@linutronix.de>
Hi Gregor,
On 20/07/26 14:20, Gregor Herburger wrote:
> The hvs and v3d drivers use dev_get_drvdata(master) in their unbind
> functions. Since the vc4-drm gets removed before its dependent drivers
> (vc4_hvs/vc4_v3d) the vc4_hvs_unbind/vc4_v3d_unbind functions try to
> get drvdata of its master and fails with a null dereference error.
>
> Use the data pointer passed to the unbind functions directly instead of
> dev_get_drvdata(master). This avoids using potentially freed memory.
>
Shouldn't this patch have a "Fixes:" tag?
Best regards,
- Maíra
> Signed-off-by: Gregor Herburger <gregor.herburger@linutronix.de>
> ---
> drivers/gpu/drm/vc4/vc4_hvs.c | 2 +-
> drivers/gpu/drm/vc4/vc4_v3d.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
> index 184d51ea3fa5..e715147d091c 100644
> --- a/drivers/gpu/drm/vc4/vc4_hvs.c
> +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
> @@ -1752,7 +1752,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
> static void vc4_hvs_unbind(struct device *dev, struct device *master,
> void *data)
> {
> - struct drm_device *drm = dev_get_drvdata(master);
> + struct drm_device *drm = data;
> struct vc4_dev *vc4 = to_vc4_dev(drm);
> struct vc4_hvs *hvs = vc4->hvs;
> struct drm_mm_node *node, *next;
> diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
> index d31b906cb8e7..f32410420d3e 100644
> --- a/drivers/gpu/drm/vc4/vc4_v3d.c
> +++ b/drivers/gpu/drm/vc4/vc4_v3d.c
> @@ -494,7 +494,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
> static void vc4_v3d_unbind(struct device *dev, struct device *master,
> void *data)
> {
> - struct drm_device *drm = dev_get_drvdata(master);
> + struct drm_device *drm = data;
> struct vc4_dev *vc4 = to_vc4_dev(drm);
>
> vc4_irq_uninstall(drm);
>
> ---
> base-commit: 58717b2a1365d06c8c64b72aa948541b53fe31eb
> change-id: 20260715-rpi-vc4-fix-d93513b05425
>
> Best regards,
> --
> Gregor Herburger <gregor.herburger@linutronix.de>
>
next prev parent reply other threads:[~2026-07-21 12:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 17:20 Gregor Herburger
2026-07-21 12:28 ` Maíra Canal [this message]
2026-07-21 13:43 ` Gregor Herburger
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=b1a84b2e-1f34-469f-898c-1dfb76efe2df@igalia.com \
--to=mcanal@igalia.com \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregor.herburger@linutronix.de \
--cc=kernel-list@raspberrypi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®