Message ID | 20240531135608.194168-1-qq810974084@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/tegra: fix a possible null pointer dereference | expand |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index be61c9d1a4f0..7648e129c212 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1388,7 +1388,8 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) if (crtc->state) tegra_crtc_atomic_destroy_state(crtc, crtc->state); - __drm_atomic_helper_crtc_reset(crtc, &state->base); + if (state) + __drm_atomic_helper_crtc_reset(crtc, &state->base); } static struct drm_crtc_state *
In malidp_tegra_crtc_reset, new memory is allocated with kzalloc, but no check is performed. Before calling __drm_atomic_helper_crtc_reset, mw_state should be checked to prevent possible null pointer dereferene. Fixes: b7e0b04ae450 ("drm/tegra: Convert to using __drm_atomic_helper_crtc_reset() for reset.") Signed-off-by: Huai-Yuan Liu <qq810974084@gmail.com> --- drivers/gpu/drm/tegra/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)