ion: fix illegal access to use after free
authorhyesoo.yu <hyesoo.yu@samsung.com>
Thu, 9 Aug 2018 05:23:36 +0000 (14:23 +0900)
committerhskang <hs1218.kang@samsung.com>
Thu, 11 Oct 2018 01:58:45 +0000 (10:58 +0900)
Change-Id: I78cf27c6bc47e25c4523383aec80b5a38d250705
Signed-off-by: hyesoo.yu <hyesoo.yu@samsung.com>
drivers/staging/android/ion/ion_carveout_heap.c

index 61eff5c0f3bea451c7c0ee8f8aba569f18e65f98..0785d2db9720522feb184eebbfdf9873f9926835 100644 (file)
@@ -234,8 +234,8 @@ struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data)
        carveout_heap->heap.name = kstrndup(heap_data->name,
                                            MAX_HEAP_NAME - 1, GFP_KERNEL);
        if (!carveout_heap->heap.name) {
-               kfree(carveout_heap);
                gen_pool_destroy(carveout_heap->pool);
+               kfree(carveout_heap);
                return ERR_PTR(-ENOMEM);
        }
        carveout_heap->size = heap_data->size;