Patch "drm/vc4: Fix NULL pointer dereference in vc4_save_hang_state()" has been added to the 4.14-stable tree
Subsystems (4)
This is a note to let you know that I've just added the patch titled
drm/vc4: Fix NULL pointer dereference in vc4_save_hang_state()
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
drm-vc4-fix-null-pointer-dereference-in-vc4_save_hang_state.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
17b11b76b87afe9f8be199d7a5f442497133e2b0Mon Sep 17 00:00:00 2001
From: Boris Brezillon <[email protected]>
Date: Thu, 18 Jan 2018 15:58:21 +0100
Subject: drm/vc4: Fix NULL pointer dereference in vc4_save_hang_state()
From: Boris Brezillon <[email protected]>
commit 17b11b76b87afe9f8be199d7a5f442497133e2b0 upstream.
When saving BOs in the hang state we skip one entry of the kernel_state->bo[] array, thus leaving it to NULL. This leads to a NULL pointer dereference when, later in this function, we iterate over all BOs to check their ->madv state.
--- drivers/gpu/drm/vc4/vc4_gem.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +6 -6
@@ -146,7 +146,7 @@ vc4_save_hang_state(struct drm_device *dstruct vc4_exec_info *exec[2 ];struct vc4_bo *bo;unsigned long irqflags; -unsigned int i, j, unref_list_count, prev_idx; +unsigned int i, j, k, unref_list_count; kernel_state =kcalloc (1 ,sizeof (*kernel_state),GFP_KERNEL );if (!kernel_state)
@@ -182,24 +182,24 @@ vc4_save_hang_state(struct drm_device *dreturn ; } - prev_idx =0 ; + k =0 ;for (i =0 ; i <2 ; i++) {if (!exec[i])continue ;for (j =0 ; j < exec[i]->bo_count; j++) {drm_gem_object_get (&exec[i]->bo[j]->base); - kernel_state->bo[j + prev_idx] = &exec[i]->bo[j]->base; + kernel_state->bo[k++] = &exec[i]->bo[j]->base; }list_for_each_entry (bo, &exec[i]->unref_list, unref_head) {drm_gem_object_get (&bo->base.base); - kernel_state->bo[j + prev_idx] = &bo->base.base; - j++; + kernel_state->bo[k++] = &bo->base.base; } - prev_idx = j +1 ; } +WARN_ON_ONCE (k != state->bo_count); +if (exec[0 ]) state->start_bin = exec[0 ]->ct0ca;if (exec[1 ])
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/drm-vc4-fix-null-pointer-dereference-in-vc4_save_hang_state.patch