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: <2025031316-frail-twitch-7313@gregkh>
Date: Thu, 13 Mar 2025 11:03:21 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Ma Ke <make24@...as.ac.cn>
Cc: lduncan@...e.com, cleech@...hat.com, michael.christie@...cle.com,
	James.Bottomley@...senpartnership.com, martin.petersen@...cle.com,
	James.Bottomley@...eleye.com, open-iscsi@...glegroups.com,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	stable@...r.kernel.org
Subject: Re: [PATCH] [SCSI] iscsi: fix error handling in iscsi_add_session()

On Thu, Mar 13, 2025 at 04:15:07PM +0800, Ma Ke wrote:
> Once device_add() failed, we should call put_device() to decrement
> reference count for cleanup. Or it could cause memory leak.
> 
> As comment of device_add() says, 'if device_add() succeeds, you should
> call device_del() when you want to get rid of it. If device_add() has
> not succeeded, use only put_device() to drop the reference count'.
> 
> Found by code review.
> 
> Cc: stable@...r.kernel.org
> Fixes: 8434aa8b6fe5 ("[SCSI] iscsi: break up session creation into two stages")
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
>  drivers/scsi/scsi_transport_iscsi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 9c347c64c315..74333e182612 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -2114,6 +2114,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
>  release_dev:
>  	device_del(&session->dev);
>  release_ida:
> +	put_device(&session->dev);
>  	if (session->ida_used)
>  		ida_free(&iscsi_sess_ida, session->target_id);
>  destroy_wq:

How was this tested?

I do not think this change is correct at all, please prove it by showing
how it was tested.

thanks,


greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ