Skip to content

Commit

Permalink
mm/kmap/kmm_map.c: Fix argument to gran_free
Browse files Browse the repository at this point in the history
Fix a memory corruption & deadlocks while calling gran_free.

The function expects a GRAN_HANDLE as a paramter, not a pointer to it.

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
Jukka Laitinen authored and jlaitine committed Jan 15, 2025
1 parent 9f5bf9d commit 2b217f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/kmap/kmm_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static FAR void *map_pages(FAR void **pages, size_t npages, int prot)
errout_with_pgmap:
up_addrenv_kunmap_pages((uintptr_t)vaddr, npages);
errout_with_vaddr:
gran_free(&g_kmm_map_vpages, vaddr, size);
gran_free(g_kmm_map_vpages, vaddr, size);
return NULL;
}

Expand Down Expand Up @@ -385,7 +385,7 @@ void kmm_unmap(FAR void *kaddr)

/* Release the virtual memory area for use */

gran_free(&g_kmm_map_vpages, entry->vaddr, entry->length);
gran_free(g_kmm_map_vpages, entry->vaddr, entry->length);

/* Remove the mapping from the kernel mapping list */

Expand Down

0 comments on commit 2b217f7

Please sign in to comment.