9cd549b355138ebbce08c3d73136d1488ed93e42
[openwrt/staging/pepe2k.git] /
1 From 8c51f78f0fb8bd8a3bab02155eea8d1f5cdc1a9b Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 25 Jan 2023 12:38:37 +0100
4 Subject: [PATCH] drm/vc4: hvs: Initialize the dlist allocation list
5 entry
6
7 The vc4_hvs_dlist_allocation structure has a list that we don't
8 initialize when we allocate a new instance.
9
10 This makes any call reading the list structure (such as list_empty) fail
11 with a NULL pointer dereference.
12
13 Let's make sure our list is always initialized.
14
15 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
16 ---
17 drivers/gpu/drm/vc4/vc4_hvs.c | 2 ++
18 1 file changed, 2 insertions(+)
19
20 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
21 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
22 @@ -452,6 +452,8 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs
23 if (!alloc)
24 return ERR_PTR(-ENOMEM);
25
26 + INIT_LIST_HEAD(&alloc->node);
27 +
28 spin_lock_irqsave(&hvs->mm_lock, flags);
29 ret = drm_mm_insert_node(&hvs->dlist_mm, &alloc->mm_node,
30 dlist_count);