* [patch] IB/iser: use after free in iser_snd_completion()
@ 2014-01-29 13:18 Dan Carpenter
2014-01-30 21:04 ` Or Gerlitz
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-01-29 13:18 UTC (permalink / raw)
To: Or Gerlitz
Cc: Roi Dayan, Roland Dreier, Sean Hefty, Hal Rosenstock,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
We use "tx_desc" again after we free it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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,
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));
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] IB/iser: use after free in iser_snd_completion()
2014-01-29 13:18 [patch] IB/iser: use after free in iser_snd_completion() Dan Carpenter
@ 2014-01-30 21:04 ` Or Gerlitz
[not found] ` <CAJZOPZ+NccdZU7n6pOs2hgim5PWQmU6PdvGxqcTxDErcJmALNA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Or Gerlitz @ 2014-01-30 21:04 UTC (permalink / raw)
To: Dan Carpenter
Cc: Or Gerlitz, Roi Dayan, Roland Dreier, Sean Hefty, Hal Rosenstock,
linux-rdma, kernel-janitors
On Wed, Jan 29, 2014, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> 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,
> 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-30 21:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 13:18 [patch] IB/iser: use after free in iser_snd_completion() Dan Carpenter
2014-01-30 21:04 ` Or Gerlitz
[not found] ` <CAJZOPZ+NccdZU7n6pOs2hgim5PWQmU6PdvGxqcTxDErcJmALNA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-01-30 21:05 ` Or Gerlitz
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).