Commit 780351a5 authored by Qiu-ji Chen's avatar Qiu-ji Chen Committed by Thierry Reding
Browse files

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: b7e0b04a ("drm/tegra: Convert to using __drm_atomic_helper_crtc_reset() for reset.")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarQiu-ji Chen <chenqiuji666@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20241106095906.15247-1-chenqiuji666@gmail.com
parent 3c364233
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1393,7 +1393,10 @@ static void tegra_crtc_reset(struct drm_crtc *crtc)
	if (crtc->state)
		tegra_crtc_atomic_destroy_state(crtc, crtc->state);

	if (state)
		__drm_atomic_helper_crtc_reset(crtc, &state->base);
	else
		__drm_atomic_helper_crtc_reset(crtc, NULL);
}

static struct drm_crtc_state *