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] [day] [month] [year] [list]
Message-ID: <fe0a1e51-8b88-4f6d-98ec-a5e6c2a12e8d@grimberg.me>
Date: Mon, 10 Jun 2024 13:02:39 +0300
From: Sagi Grimberg <sagi@...mberg.me>
To: Alexander Sapozhnikov <alsp705@...il.com>, Christoph Hellwig
 <hch@....de>, Chaitanya Kulkarni <kch@...dia.com>
Cc: linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org,
 lvc-project@...uxtesting.org
Subject: Re: [PATCH] drivers: nvme: target: core: deref after null



On 07/06/2024 16:43, Alexander Sapozhnikov wrote:
> From: Alexandr Sapozhnikov <alsp705@...il.com>
>
> After having been compared to a NULL value at core.c:813,
> pointer '(**sq->ctrl).sqs' is dereferenced at core.c:838.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Alexandr Sapozhnikov <alsp705@...il.com>
> ---
>   drivers/nvme/target/core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 06f0c587f343..5a67d2bc0c55 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -827,7 +827,7 @@ void nvmet_sq_destroy(struct nvmet_sq *sq)
>   	 */
>   	ctrl = sq->ctrl;
>   
> -	if (ctrl) {
> +	if (ctrl && ctrl->sqs) {
>   		/*
>   		 * The teardown flow may take some time, and the host may not
>   		 * send us keep-alive during this period, hence reset the

This is a redundant check. sq->ctrl and sq->ctrl->sqs have the same 
lifetime. If
sq->ctrl was assigned, it means that it was allocated and needs a final 
put to
fully cleanup. ctrl->sqs is allocated in nvmet_alloc_ctrl and freed in 
nvmet_free_ctrl
which is the final reference.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ