Commit 114a0677 authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Changpeng Liu
Browse files

nvmf/rdma: pd null check



In case of pd allocation by nvmf hooks there is a lack of null
check as oposed to pd allocation by ibv_alloc_pd.

Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Iead6e0332bdee3da4adb6e657af298215c4e2196
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461576


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent e2c0d9a2
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -2128,7 +2128,6 @@ spdk_nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts)
	int rc;
	struct spdk_nvmf_rdma_transport *rtransport;
	struct spdk_nvmf_rdma_device	*device, *tmp;
	struct ibv_pd			*pd;
	struct ibv_context		**contexts;
	uint32_t			i;
	int				flag;
@@ -2282,21 +2281,17 @@ spdk_nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts)
		TAILQ_INSERT_TAIL(&rtransport->devices, device, link);
		i++;

		pd = NULL;
		if (g_nvmf_hooks.get_ibv_pd) {
			pd = g_nvmf_hooks.get_ibv_pd(NULL, device->context);
			device->pd = g_nvmf_hooks.get_ibv_pd(NULL, device->context);
		} else {
			device->pd = ibv_alloc_pd(device->context);
		}

		if (!g_nvmf_hooks.get_ibv_pd) {
			device->pd = ibv_alloc_pd(device->context);
		if (!device->pd) {
			SPDK_ERRLOG("Unable to allocate protection domain.\n");
			spdk_nvmf_rdma_destroy(&rtransport->transport);
			return NULL;
		}
		} else {
			device->pd = pd;
		}

		assert(device->map == NULL);