Re: [patch] IB/iser: use after free in iser_snd_completion()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 29, 2014, Dan Carpenter <dan.carpenter@xxxxxxxxxx> 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@xxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux