* [PATCH 1/1] drivers: infiniband: ulp: Fix possible use-after-free
@ 2013-10-14 0:22 Felipe Pena
0 siblings, 0 replies; only message in thread
From: Felipe Pena @ 2013-10-14 0:22 UTC (permalink / raw)
To: Or Gerlitz, Roi Dayan, Roland Dreier, Sean Hefty, Hal Rosenstock
Cc: linux-rdma, linux-kernel, Felipe Pena
The tx_desc variable is being used to access its type member
after a kmem_cache_free call
Signed-off-by: Felipe Pena <felipensp@gmail.com>
---
drivers/infiniband/ulp/iser/iser_initiator.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 5388226..15b545c 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -610,17 +610,15 @@ void iser_snd_completion(struct iser_tx_desc *tx_desc,
ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr,
ISER_HEADERS_LEN, DMA_TO_DEVICE);
kmem_cache_free(ig.desc_cache, tx_desc);
- }
-
- atomic_dec(&ib_conn->post_send_buf_count);
-
- if (tx_desc->type == ISCSI_TX_CONTROL) {
+ } else if (tx_desc->type == ISCSI_TX_CONTROL) {
/* this arithmetic is legal by libiscsi dd_data allocation */
task = (void *) ((long)(void *)tx_desc -
sizeof(struct iscsi_task));
if (task->hdr->itt == RESERVED_ITT)
iscsi_put_task(task);
}
+
+ atomic_dec(&ib_conn->post_send_buf_count);
}
void iser_task_rdma_init(struct iscsi_iser_task *iser_task)
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-10-14 0:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-14 0:22 [PATCH 1/1] drivers: infiniband: ulp: Fix possible use-after-free Felipe Pena
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).