Commit 8e098e41 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvme: verify remove_cb is non-NULL before calling



This fixes the VFIO hot-remove path, which called remove_cb without
checking to see if it had been specified by the user.  The normal uevent
removal path already checked for remove_cb.

Change-Id: I0ad8d2c90a77b16800a8b505cb69ea05b0706d70
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/408392


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 3fa7c33a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -299,11 +299,13 @@ _nvme_pcie_hotplug_monitor(void *cb_ctx, spdk_nvme_probe_cb probe_cb,
		csts = spdk_nvme_ctrlr_get_regs_csts(ctrlr);
		if (csts.raw == 0xffffffffU) {
			nvme_ctrlr_fail(ctrlr, true);
			if (remove_cb) {
				nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
				remove_cb(cb_ctx, ctrlr);
				nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
			}
		}
	}
	return 0;
}