0275-drm-vc4-allocate-enough-memory-in-vc4_save_hang_stat.patch 1014 B

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