mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
drm/atomic: Only call atomic_destroy_state on a !NULL pointer
The drm_atomic_commit structure is freed through the drm_atomic_commit_put() function, that eventually calls drm_atomic_commit_default_clear() by default when there's no active users of that state. It then iterates over all objects with a state, and will call the atomic_destroy_state callback on the state pointer. The state pointer is mostly used these days to point to which of the old or new state needs to be freed, depending on whether the state was committed or not. So it all makes sense. However, with the hardware state readout support approaching, we might have a state, with multiple objects in it, but no state to free because we want them to persist. In such a case, the state pointer is going to be NULL, and thus we'll end up with NULL pointer dereference. Test if the state pointer is non-NULL before calling atomic_destroy_state on it. Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20260907-drm-state-readout-v5-8-5fa1ac7a5148@kernel.org Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
parent
4a7a146f1c
commit
5494df621f
1 changed files with 15 additions and 8 deletions
Loading…
Add table
Add a link
Reference in a new issue