From e4abd9074b7981e8b2181e7a9a33f768e66965db Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Wed, 25 Jan 2023 12:38:37 +0100 Subject: [PATCH 576/726] drm/vc4: hvs: Initialize the dlist allocation list entry The vc4_hvs_dlist_allocation structure has a list that we don't initialize when we allocate a new instance. This makes any call reading the list structure (such as list_empty) fail with a NULL pointer dereference. Let's make sure our list is always initialized. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hvs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index ecb19422e2ac..c9c7b841385d 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -452,6 +452,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs *hvs, if (!alloc) return ERR_PTR(-ENOMEM); + INIT_LIST_HEAD(&alloc->node); + spin_lock_irqsave(&hvs->mm_lock, flags); ret = drm_mm_insert_node(&hvs->dlist_mm, &alloc->mm_node, dlist_count); -- 2.33.1