From: Maxime Ripard <maxime@cerno.tech>
To: "José Expósito" <jose.exposito89@gmail.com>
Cc: emma@anholt.net, airlied@gmail.com, daniel@ffwll.ch,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/vc4: hdmi: Fix pointer dereference before check
Date: Wed, 2 Nov 2022 10:01:53 +0100 [thread overview]
Message-ID: <20221102090153.tujblkvd3jlhdtxr@houat> (raw)
In-Reply-To: <20221029093413.546103-1-jose.exposito89@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1718 bytes --]
Hi,
On Sat, Oct 29, 2022 at 11:34:13AM +0200, José Expósito wrote:
> Commit 6bed2ea3cb38 ("drm/vc4: hdmi: Reset link on hotplug") introduced
> the vc4_hdmi_reset_link() function. This function dereferences the
> "connector" pointer before checking whether it is NULL or not.
>
> Rework variable assignment to avoid this issue.
>
> Fixes: 6bed2ea3cb38 ("drm/vc4: hdmi: Reset link on hotplug")
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
> ---
> drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 4a73fafca51b..07d058b6afb7 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -319,9 +319,9 @@ static int reset_pipe(struct drm_crtc *crtc,
> static int vc4_hdmi_reset_link(struct drm_connector *connector,
> struct drm_modeset_acquire_ctx *ctx)
> {
> - struct drm_device *drm = connector->dev;
> - struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
> - struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
> + struct drm_device *drm;
> + struct vc4_hdmi *vc4_hdmi;
> + struct drm_encoder *encoder;
> struct drm_connector_state *conn_state;
> struct drm_crtc_state *crtc_state;
> struct drm_crtc *crtc;
> @@ -332,6 +332,10 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector,
> if (!connector)
> return 0;
>
> + drm = connector->dev;
> + vc4_hdmi = connector_to_vc4_hdmi(connector);
> + encoder = &vc4_hdmi->encoder.base;
> +
I don't think that's right. Connector shouldn't be NULL to begin with,
how did you notice this?
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-11-02 9:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 9:34 José Expósito
2022-11-02 9:01 ` Maxime Ripard [this message]
2022-11-02 11:10 ` José Expósito
2022-11-07 8:26 ` Maxime Ripard
2022-11-07 11:58 ` Ville Syrjälä
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=20221102090153.tujblkvd3jlhdtxr@houat \
--to=maxime@cerno.tech \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emma@anholt.net \
--cc=jose.exposito89@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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®