lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad4a9a41-00d7-49b1-c5f0-db58a824e6a0@mellanox.com>
Date:   Mon, 9 Mar 2020 23:53:32 +0200
From:   Max Gurtovoy <maxg@...lanox.com>
To:     Prabhath Sajeepa <psajeepa@...estorage.com>, <kbusch@...nel.org>,
        <axboe@...com>, <hch@....de>, <sagi@...mberg.me>,
        <linux-nvme@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
CC:     <roland@...estorage.com>
Subject: Re: [PATCH] nvme-rdma: Avoid double freeing of async event data


On 3/9/2020 11:07 PM, Prabhath Sajeepa wrote:
> The timeout of identify cmd, which is invoked as part of admin queue
> creation, can result in freeing of async event data both in
> nvme_rdma_timeout handler and error handling path of
> nvme_rdma_configure_admin queue thus causing NULL pointer reference.
> Call Trace:
>   ? nvme_rdma_setup_ctrl+0x223/0x800 [nvme_rdma]
>   nvme_rdma_create_ctrl+0x2ba/0x3f7 [nvme_rdma]
>   nvmf_dev_write+0xa54/0xcc6 [nvme_fabrics]
>   __vfs_write+0x1b/0x40
>   vfs_write+0xb2/0x1b0
>   ksys_write+0x61/0xd0
>   __x64_sys_write+0x1a/0x20
>   do_syscall_64+0x60/0x1e0
>   entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
> Signed-off-by: Prabhath Sajeepa <psajeepa@...estorage.com>
> Reviewed-by: Roland Dreier <roland@...estorage.com>
> ---
>   drivers/nvme/host/rdma.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 3e85c5c..0fe08c4 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -850,9 +850,11 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
>   	if (new)
>   		blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
>   out_free_async_qe:
> -	nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
> -		sizeof(struct nvme_command), DMA_TO_DEVICE);
> -	ctrl->async_event_sqe.data = NULL;
> +	if (ctrl->async_event_sqe.data) {
> +		nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
> +			sizeof(struct nvme_command), DMA_TO_DEVICE);
> +		ctrl->async_event_sqe.data = NULL;
> +	}
>   out_free_queue:
>   	nvme_rdma_free_queue(&ctrl->queues[0]);
>   	return error;

Looks good,

Reviewed-by: Max Gurtovoy <maxg@...lanox.com>


We did the same fix in-house yesterday and planed to send it tomorrow :)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ