0272-drm-vc4-allocate-enough-memory-in-vc4_save_hang_stat.patch 1005 B

1234567891011121314151617181920212223242526
  1. From 3c2d156ad9e5e45d46938d2138aca038df44b9d3 Mon Sep 17 00:00:00 2001
  2. From: Dan Carpenter <dan.carpenter@oracle.com>
  3. Date: Thu, 17 Dec 2015 15:39:08 +0300
  4. Subject: [PATCH] drm/vc4: allocate enough memory in vc4_save_hang_state()
  5. "state" is smaller than "kernel_state" so we end up corrupting memory.
  6. Fixes: 214613656b51 ('drm/vc4: Add an interface for capturing the GPU state after a hang.')
  7. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  8. Reviewed-by: Eric Anholt <eric@anholt.net>
  9. (cherry picked from commit 7e5082fbc00cc157e57a70cdb6b9bbb21289afb1)
  10. ---
  11. drivers/gpu/drm/vc4/vc4_gem.c | 2 +-
  12. 1 file changed, 1 insertion(+), 1 deletion(-)
  13. --- a/drivers/gpu/drm/vc4/vc4_gem.c
  14. +++ b/drivers/gpu/drm/vc4/vc4_gem.c
  15. @@ -159,7 +159,7 @@ vc4_save_hang_state(struct drm_device *d
  16. unsigned long irqflags;
  17. unsigned int i, unref_list_count;
  18. - kernel_state = kcalloc(1, sizeof(*state), GFP_KERNEL);
  19. + kernel_state = kcalloc(1, sizeof(*kernel_state), GFP_KERNEL);
  20. if (!kernel_state)
  21. return;