1b41df0558
We must keep the lock held after removing the io_ch from the thread before iterating the list of threads to check for other channels referencing this thread. Without it, it is possible for two different threads to think they are the last thread holding a reference to an unregistered device, and both will call the unregister_cb and free the dev memory. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ifcc18752937731722fefc6e2161ee41443c4fb86 Reviewed-on: https://review.gerrithub.io/404410 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>