Skip to content

Commit 780351a

Browse files
TomRita999thierryreding
authored andcommitted
drm/tegra: Fix a possible null pointer dereference
In tegra_crtc_reset(), new memory is allocated with kzalloc(), but no check is performed. Before calling __drm_atomic_helper_crtc_reset, state should be checked to prevent possible null pointer dereference. Fixes: b7e0b04 ("drm/tegra: Convert to using __drm_atomic_helper_crtc_reset() for reset.") Cc: [email protected] Signed-off-by: Qiu-ji Chen <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3c36423 commit 780351a

File tree

1 file changed

+4
-1
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+4
-1
lines changed

drivers/gpu/drm/tegra/dc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,10 @@ static void tegra_crtc_reset(struct drm_crtc *crtc)
13931393
if (crtc->state)
13941394
tegra_crtc_atomic_destroy_state(crtc, crtc->state);
13951395

1396-
__drm_atomic_helper_crtc_reset(crtc, &state->base);
1396+
if (state)
1397+
__drm_atomic_helper_crtc_reset(crtc, &state->base);
1398+
else
1399+
__drm_atomic_helper_crtc_reset(crtc, NULL);
13971400
}
13981401

13991402
static struct drm_crtc_state *

0 commit comments

Comments
 (0)