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: Jacek Kalwas <jacek.kalwas@intel.com> Change-Id: Iead6e0332bdee3da4adb6e657af298215c4e2196 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461576 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
e2c0d9a294
commit
114a067738
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user