diff options
author | Erik Staats <estaats@google.com> | 2022-02-08 07:17:15 -0800 |
---|---|---|
committer | Erik Staats <estaats@google.com> | 2022-02-08 07:17:15 -0800 |
commit | bbda5c3073bfb6723c6b4b65097da5bec2de32c1 (patch) | |
tree | 244e6aebb47cf81787f3ea22a7c0952ec7831796 /mali_pixel | |
parent | 2f5da18856d5a2958bbdac0b253ea386396c707f (diff) | |
download | gpu-bbda5c3073bfb6723c6b4b65097da5bec2de32c1.tar.gz |
Mali PMA: Check for NULL slab when deallocating.
Bug: 216077469
Test: Verified Cheetah boots.
Change-Id: I840fa349af3a2af4812c087cd6beb5874460d5a7
Diffstat (limited to 'mali_pixel')
-rw-r--r-- | mali_pixel/protected_memory_allocator.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/mali_pixel/protected_memory_allocator.c b/mali_pixel/protected_memory_allocator.c index 7e5570d..32d38fb 100644 --- a/mali_pixel/protected_memory_allocator.c +++ b/mali_pixel/protected_memory_allocator.c @@ -295,16 +295,22 @@ static void mali_pma_slab_dealloc( /* Lock the slab list. */ mutex_lock(&(mali_pma_dev->slab_mutex)); - /* Deallocate all the blocks in the slab. */ + /* Get the slab. */ slab = mali_pma->slab; - bitmap_clear((unsigned long *) &(slab->allocated_block_map), - mali_pma->first_block_index, mali_pma->block_count); - /* If no slab blocks remain allocated, remove the slab. */ - if (bitmap_empty( - (unsigned long *) &(slab->allocated_block_map), - MALI_PMA_SLAB_BLOCK_COUNT)) { - mali_pma_slab_remove(mali_pma_dev, slab); + /* Deallocate the slab. */ + if (slab != NULL) { + /* Deallocate all the blocks in the slab. */ + bitmap_clear((unsigned long *) &(slab->allocated_block_map), + mali_pma->first_block_index, + mali_pma->block_count); + + /* If no slab blocks remain allocated, remove the slab. */ + if (bitmap_empty( + (unsigned long *) &(slab->allocated_block_map), + MALI_PMA_SLAB_BLOCK_COUNT)) { + mali_pma_slab_remove(mali_pma_dev, slab); + } } /* Unlock the slab list. */ |