diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-11-08 16:00:11 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-11-11 11:20:23 -0500 |
commit | 9c8a3df142a0c7d81546c677a8f4ed39fb08dd9a (patch) | |
tree | 62e4e1260a7a71d9ebe1a1222f93fbeca6426ae6 /drivers/gpu/nvgpu/gk20a | |
parent | 9d4f04a68e4661710963b6a4a33f4742684d07a4 (diff) |
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 <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1249959
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c | 10 |
1 files changed, 5 insertions, 5 deletions
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) | |||
629 | 629 | ||
630 | a->nr_frees++; | 630 | a->nr_frees++; |
631 | 631 | ||
632 | palloc_dbg(a, "Free 0x%llx id=0x%010llx\n", | ||
633 | alloc->length, alloc->base); | ||
634 | |||
632 | /* | 635 | /* |
633 | * Frees *alloc. | 636 | * Frees *alloc. |
634 | */ | 637 | */ |
@@ -639,9 +642,6 @@ static void gk20a_page_free(struct gk20a_allocator *__a, u64 base) | |||
639 | __gk20a_free_pages(a, alloc, true); | 642 | __gk20a_free_pages(a, alloc, true); |
640 | } | 643 | } |
641 | 644 | ||
642 | palloc_dbg(a, "Free 0x%llx id=0x%010llx\n", | ||
643 | alloc->length, alloc->base); | ||
644 | |||
645 | done: | 645 | done: |
646 | alloc_unlock(__a); | 646 | alloc_unlock(__a); |
647 | } | 647 | } |
@@ -740,10 +740,10 @@ static void gk20a_page_free_fixed(struct gk20a_allocator *__a, | |||
740 | * allocs. This would have to be updated if the underlying | 740 | * allocs. This would have to be updated if the underlying |
741 | * allocator were to change. | 741 | * allocator were to change. |
742 | */ | 742 | */ |
743 | __gk20a_free_pages(a, alloc, true); | ||
744 | |||
745 | palloc_dbg(a, "Free [fixed] 0x%010llx + 0x%llx\n", | 743 | palloc_dbg(a, "Free [fixed] 0x%010llx + 0x%llx\n", |
746 | alloc->base, alloc->length); | 744 | alloc->base, alloc->length); |
745 | __gk20a_free_pages(a, alloc, true); | ||
746 | |||
747 | a->nr_fixed_frees++; | 747 | a->nr_fixed_frees++; |
748 | a->pages_freed += (alloc->length >> a->page_shift); | 748 | a->pages_freed += (alloc->length >> a->page_shift); |
749 | 749 | ||