Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/vc4: hdmi: Fix pointer dereference before check

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>
Link: https://lore.kernel.org/r/20221110134752.238820-3-jose.exposito89@gmail.com
Signed-off-by: Maxime Ripard <maxime@cerno.tech>

authored by

José Expósito and committed by
Maxime Ripard
0a99962c d2187508

+4 -2
+4 -2
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 318 318 static int vc4_hdmi_reset_link(struct drm_connector *connector, 319 319 struct drm_modeset_acquire_ctx *ctx) 320 320 { 321 - struct drm_device *drm = connector->dev; 322 - struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); 321 + struct drm_device *drm; 322 + struct vc4_hdmi *vc4_hdmi; 323 323 struct drm_connector_state *conn_state; 324 324 struct drm_crtc_state *crtc_state; 325 325 struct drm_crtc *crtc; ··· 330 330 if (!connector) 331 331 return 0; 332 332 333 + drm = connector->dev; 333 334 ret = drm_modeset_lock(&drm->mode_config.connection_mutex, ctx); 334 335 if (ret) 335 336 return ret; ··· 348 347 if (!crtc_state->active) 349 348 return 0; 350 349 350 + vc4_hdmi = connector_to_vc4_hdmi(connector); 351 351 if (!vc4_hdmi_supports_scrambling(vc4_hdmi)) 352 352 return 0; 353 353