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: <9dfb46b3-3dfe-40ea-9eae-c6a2533ad950@oracle.com>
Date: Mon, 24 Mar 2025 22:03:24 -0500
From: Mike Christie <michael.christie@...cle.com>
To: linmq006@...il.com, Lee Duncan <lduncan@...e.com>,
        Chris Leech <cleech@...hat.com>,
        "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Lin Ma
 <linma@....edu.cn>, open-iscsi@...glegroups.com,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scsi: iscsi: Fix missing scsi_host_put in error path

On 3/18/25 4:43 AM, linmq006@...il.com wrote:
> From: Miaoqian Lin <linmq006@...il.com>
> 
> Add goto to ensure scsi_host_put is called in all error paths of
> iscsi_set_host_param function. This fixes a potential memory leak when
> strlen check fails.
> 
> Fixes: ce51c8170084 ("scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
>  drivers/scsi/scsi_transport_iscsi.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 9c347c64c315..0b8c91bf793f 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -3182,11 +3182,14 @@ iscsi_set_host_param(struct iscsi_transport *transport,
>  	}
>  
>  	/* see similar check in iscsi_if_set_param() */
> -	if (strlen(data) > ev->u.set_host_param.len)
> -		return -EINVAL;
> +	if (strlen(data) > ev->u.set_host_param.len) {
> +		err = -EINVAL;
> +		goto out;
> +	}
>  
>  	err = transport->set_host_param(shost, ev->u.set_host_param.param,
>  					data, ev->u.set_host_param.len);
> +out:
>  	scsi_host_put(shost);
>  	return err;
>  }

Reviewed-by: Mike Christie <michael.christie@...cle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ