* [PATCH] RDMA/iser: Fix a resource leak in iser_send_data_out()
@ 2026-12-04 7:46 Wanhui Fu
2026-12-04 7:55 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-12-04 7:46 UTC (permalink / raw)
To: sagi, mgurtovoy, jgg, leon, ogerlitz, rolandd; +Cc: linux-rdma, Wanhui Fu
iser_initialize_task_headers() maps tx descriptor address
but leaves the mapping active if data range is invalid or
post fails. Fix this by calling ib_dma_unmap_single() on
error path.
Found by a self-developed static analysis tool and compile-
test passed.
Fixes: f19624aa9200 ("IB/iser: Simplify send flow/descriptors")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
drivers/infiniband/ulp/iser/iser_initiator.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 8c2063a50243..64a1d5665b27 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -454,7 +454,7 @@ int iser_send_data_out(struct iscsi_conn *conn, struct iscsi_task *task,
buf_offset, data_seg_len,
iser_task->data[ISER_DIR_OUT].data_len, itt);
err = -EINVAL;
- goto send_data_out_error;
+ goto unmap_headers;
}
iser_dbg("data-out itt: %d, offset: %ld, sz: %ld\n",
itt, buf_offset, data_seg_len);
@@ -463,6 +463,9 @@ int iser_send_data_out(struct iscsi_conn *conn, struct iscsi_task *task,
if (!err)
return 0;
+unmap_headers:
+ ib_dma_unmap_single(iser_conn->ib_conn.device->ib_device,
+ tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE);
send_data_out_error:
kmem_cache_free(ig.desc_cache, tx_desc);
iser_err("conn %p failed err %d\n", conn, err);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/iser: Fix a resource leak in iser_send_data_out()
2026-12-04 7:46 [PATCH] RDMA/iser: Fix a resource leak in iser_send_data_out() Wanhui Fu
@ 2026-12-04 7:55 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-04 7:55 UTC (permalink / raw)
To: Wanhui Fu; +Cc: linux-rdma
> iser_initialize_task_headers() maps tx descriptor address
> but leaves the mapping active if data range is invalid or
> post fails. Fix this by calling ib_dma_unmap_single() on
> error path.
>
> Found by a self-developed static analysis tool and compile-
> test passed.
>
> Fixes: f19624aa9200 ("IB/iser: Simplify send flow/descriptors")
> Signed-off-by: Wanhui Fu <fuwh1120@163.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204074620.1573327-1-fuwh1120@163.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 7:46 [PATCH] RDMA/iser: Fix a resource leak in iser_send_data_out() Wanhui Fu
2026-12-04 7:55 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox