提交 c33b15f0 编写于 作者: R Roi Dayan 提交者: Roland Dreier

IB/iser: Fix RX/TX CQ resource leak on error flow

When failing to allocate TX CQ we already allocated RX CQ, so we need to make
sure we release it. Also, when failing to register notification to the RX CQ
we currently leak both RX and TX CQs of the current index, fix that too.
Signed-off-by: NRoi Dayan <roid@mellanox.com>
Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 52addcf9
...@@ -73,7 +73,7 @@ static int iser_create_device_ib_res(struct iser_device *device) ...@@ -73,7 +73,7 @@ static int iser_create_device_ib_res(struct iser_device *device)
{ {
struct iser_cq_desc *cq_desc; struct iser_cq_desc *cq_desc;
struct ib_device_attr *dev_attr = &device->dev_attr; struct ib_device_attr *dev_attr = &device->dev_attr;
int ret, i, j; int ret, i;
ret = ib_query_device(device->ib_device, dev_attr); ret = ib_query_device(device->ib_device, dev_attr);
if (ret) { if (ret) {
...@@ -125,16 +125,20 @@ static int iser_create_device_ib_res(struct iser_device *device) ...@@ -125,16 +125,20 @@ static int iser_create_device_ib_res(struct iser_device *device)
iser_cq_event_callback, iser_cq_event_callback,
(void *)&cq_desc[i], (void *)&cq_desc[i],
ISER_MAX_RX_CQ_LEN, i); ISER_MAX_RX_CQ_LEN, i);
if (IS_ERR(device->rx_cq[i])) if (IS_ERR(device->rx_cq[i])) {
device->rx_cq[i] = NULL;
goto cq_err; goto cq_err;
}
device->tx_cq[i] = ib_create_cq(device->ib_device, device->tx_cq[i] = ib_create_cq(device->ib_device,
NULL, iser_cq_event_callback, NULL, iser_cq_event_callback,
(void *)&cq_desc[i], (void *)&cq_desc[i],
ISER_MAX_TX_CQ_LEN, i); ISER_MAX_TX_CQ_LEN, i);
if (IS_ERR(device->tx_cq[i])) if (IS_ERR(device->tx_cq[i])) {
device->tx_cq[i] = NULL;
goto cq_err; goto cq_err;
}
if (ib_req_notify_cq(device->rx_cq[i], IB_CQ_NEXT_COMP)) if (ib_req_notify_cq(device->rx_cq[i], IB_CQ_NEXT_COMP))
goto cq_err; goto cq_err;
...@@ -160,14 +164,14 @@ static int iser_create_device_ib_res(struct iser_device *device) ...@@ -160,14 +164,14 @@ static int iser_create_device_ib_res(struct iser_device *device)
handler_err: handler_err:
ib_dereg_mr(device->mr); ib_dereg_mr(device->mr);
dma_mr_err: dma_mr_err:
for (j = 0; j < device->cqs_used; j++) for (i = 0; i < device->cqs_used; i++)
tasklet_kill(&device->cq_tasklet[j]); tasklet_kill(&device->cq_tasklet[i]);
cq_err: cq_err:
for (j = 0; j < i; j++) { for (i = 0; i < device->cqs_used; i++) {
if (device->tx_cq[j]) if (device->tx_cq[i])
ib_destroy_cq(device->tx_cq[j]); ib_destroy_cq(device->tx_cq[i]);
if (device->rx_cq[j]) if (device->rx_cq[i])
ib_destroy_cq(device->rx_cq[j]); ib_destroy_cq(device->rx_cq[i]);
} }
ib_dealloc_pd(device->pd); ib_dealloc_pd(device->pd);
pd_err: pd_err:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册