memory: fix segfault when freeing mem map with no notify_cb
In spdk_mem_map_alloc() we only do the memory walk when notify_cb is provided, but spdk_mem_map_free() does the memory walk undonditionally. Not anymore. Change-Id: Ic8dfdc5cb2c99dc58e62ab0523cf5a18ba8691cc Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/428722 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
2b6d9ce21f
commit
0d57730e29
@ -270,10 +270,12 @@ spdk_mem_map_free(struct spdk_mem_map **pmap)
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&g_spdk_mem_map_mutex);
|
||||
spdk_mem_map_notify_walk(map, SPDK_MEM_MAP_NOTIFY_UNREGISTER);
|
||||
TAILQ_REMOVE(&g_spdk_mem_maps, map, tailq);
|
||||
pthread_mutex_unlock(&g_spdk_mem_map_mutex);
|
||||
if (map->ops.notify_cb) {
|
||||
pthread_mutex_lock(&g_spdk_mem_map_mutex);
|
||||
spdk_mem_map_notify_walk(map, SPDK_MEM_MAP_NOTIFY_UNREGISTER);
|
||||
TAILQ_REMOVE(&g_spdk_mem_maps, map, tailq);
|
||||
pthread_mutex_unlock(&g_spdk_mem_map_mutex);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(map->map_256tb.map) / sizeof(map->map_256tb.map[0]); i++) {
|
||||
free(map->map_256tb.map[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user