From 9c8a3df142a0c7d81546c677a8f4ed39fb08dd9a Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 8 Nov 2016 13:00:11 -0800 Subject: gpu: nvgpu: Do not access alloc after freeing it Move debug write so that we access length and base of allocation before the alloc structure gets freed. Change-Id: I02e418f423beaa2b52a32d1abcff327b68dd5fa6 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1249959 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Seema Khowala --- drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c index f670fd98..ab0fbc64 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c @@ -629,6 +629,9 @@ static void gk20a_page_free(struct gk20a_allocator *__a, u64 base) a->nr_frees++; + palloc_dbg(a, "Free 0x%llx id=0x%010llx\n", + alloc->length, alloc->base); + /* * Frees *alloc. */ @@ -639,9 +642,6 @@ static void gk20a_page_free(struct gk20a_allocator *__a, u64 base) __gk20a_free_pages(a, alloc, true); } - palloc_dbg(a, "Free 0x%llx id=0x%010llx\n", - alloc->length, alloc->base); - done: alloc_unlock(__a); } @@ -740,10 +740,10 @@ static void gk20a_page_free_fixed(struct gk20a_allocator *__a, * allocs. This would have to be updated if the underlying * allocator were to change. */ - __gk20a_free_pages(a, alloc, true); - palloc_dbg(a, "Free [fixed] 0x%010llx + 0x%llx\n", alloc->base, alloc->length); + __gk20a_free_pages(a, alloc, true); + a->nr_fixed_frees++; a->pages_freed += (alloc->length >> a->page_shift); -- cgit v1.2.2