diff mbox series

scsi: iscsi: fix iscsi ida memory leak

Message ID 20240129090410.11105-1-kanie@linux.alibaba.com (mailing list archive)
State Rejected
Headers show
Series scsi: iscsi: fix iscsi ida memory leak | expand

Commit Message

Guixin Liu Jan. 29, 2024, 9:04 a.m. UTC
The iscsi_sess_ida should be destroy when the iscsi module exit.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/scsi/scsi_transport_iscsi.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mike Christie Jan. 29, 2024, 3:34 p.m. UTC | #1
On 1/29/24 3:04 AM, Guixin Liu wrote:
> The iscsi_sess_ida should be destroy when the iscsi module exit.
> 
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>  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 3075b2ddf7a6..3c5b42390c47 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -5046,6 +5046,7 @@ static void __exit iscsi_transport_exit(void)
>  	class_unregister(&iscsi_endpoint_class);
>  	class_unregister(&iscsi_iface_class);
>  	class_unregister(&iscsi_transport_class);
> +	ida_destroy(&iscsi_sess_ida);
>  }
>  
>  module_init(iscsi_transport_init);

When this is called the ida will be empty so I don't think we have to
call this. From the comments:

/**
 * ida_destroy() - Free all IDs.
 * @ida: IDA handle.
 *
 * Calling this function frees all IDs and releases all resources used
 * by an IDA.  When this call returns, the IDA is empty and can be reused
 * or freed.  If the IDA is already empty, there is no need to call this
 * function.
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 3075b2ddf7a6..3c5b42390c47 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -5046,6 +5046,7 @@  static void __exit iscsi_transport_exit(void)
 	class_unregister(&iscsi_endpoint_class);
 	class_unregister(&iscsi_iface_class);
 	class_unregister(&iscsi_transport_class);
+	ida_destroy(&iscsi_sess_ida);
 }
 
 module_init(iscsi_transport_init);