IB/iser: use after free in iser_snd_completion()
PATCH 1/1 IB/iser: use after free in iser_snd_completion()
We use "tx_desc" again after we free it.
Signed-off-by Dan Carpenter <[email protected]>
drivers/infiniband/ulp/iser/iser_initiator.c +2 -1
@@ -610,11 +610,12 @@ 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); + tx_desc =NULL ; }atomic_dec (&ib_conn->post_send_buf_count); -if (tx_desc->type =ISCSI_TX_CONTROL ) { +if (tx_desc && 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 ));
Quoted 1 line · Dan Carpenter
We use "
tx_desc" again after we free it.
yep, this is legacy code which isn't much of use over the last years and hence the bug went in unnoticed
Quoted 24 lines
Signed-off-by Dan Carpenter <[email protected]>drivers/infiniband/ulp/iser/iser_initiator.c +2
-2@@ -610,11 +610,12 @@ 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); + tx_desc =NULL ; }atomic_dec (&ib_conn->post_send_buf_count); -if (tx_desc->type =ISCSI_TX_CONTROL ) { +if (tx_desc && 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 )); --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAJZOPZ+NccdZU7n6pOs2hgim5PWQmU6PdvGxqcTxDErcJmALNA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Or Gerlitz
Acked-byQuoted 5 lines · Or Gerlitz
Quoted 1 line · Dan Carpenter
We use "
tx_desc" again after we free it.yep, this is legacy code which isn't much of use over the last years and hence the bug went in unnoticed
Acked-by Or Gerlitz <[email protected]>