aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-01-29 08:18:51 -0500
committerRoland Dreier <roland@purestorage.com>2014-02-14 12:48:09 -0500
commitfd8b48b22a2b7cdf21f15b01cae379e6159a7eea (patch)
treee3dcca0a35abce2741e8540c45fb0f8990a5e887 /drivers/infiniband
parent7d9eacf9457efc6b614665e1095336c11ad83f0d (diff)
IB/iser: Fix use after free in iser_snd_completion()
We use "tx_desc" again after we free it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 538822684d5b..334f34b1cd46 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -610,11 +610,12 @@ void iser_snd_completion(struct iser_tx_desc *tx_desc,
610 ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr, 610 ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr,
611 ISER_HEADERS_LEN, DMA_TO_DEVICE); 611 ISER_HEADERS_LEN, DMA_TO_DEVICE);
612 kmem_cache_free(ig.desc_cache, tx_desc); 612 kmem_cache_free(ig.desc_cache, tx_desc);
613 tx_desc = NULL;
613 } 614 }
614 615
615 atomic_dec(&ib_conn->post_send_buf_count); 616 atomic_dec(&ib_conn->post_send_buf_count);
616 617
617 if (tx_desc->type == ISCSI_TX_CONTROL) { 618 if (tx_desc && tx_desc->type == ISCSI_TX_CONTROL) {
618 /* this arithmetic is legal by libiscsi dd_data allocation */ 619 /* this arithmetic is legal by libiscsi dd_data allocation */
619 task = (void *) ((long)(void *)tx_desc - 620 task = (void *) ((long)(void *)tx_desc -
620 sizeof(struct iscsi_task)); 621 sizeof(struct iscsi_task));