Skip to contentSkip to conversation

scsi: iscsi: fix iscsi ida memory leak

PATCH In review Guixin Liu 2 participants 2 messages Jan 29, 2024

Subsystems (2)
lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

PATCH 1/1 scsi: iscsi: fix iscsi ida memory leak

The iscsi_sess_ida should be destroy when the iscsi module exit.

---
 drivers/scsi/scsi_transport_iscsi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/scsi_transport_iscsi.c +1 -0
index 3075b2ddf7a6..3c5b42390c47 100644
@@ -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);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 12 lines · Guixin Liu

The iscsi_sess_ida should be destroy when the iscsi module exit.

---
 drivers/scsi/scsi_transport_iscsi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/scsi_transport_iscsi.c +0 -0
index 3075b2ddf7a6..3c5b42390c47 100644

drivers/scsi/scsi_transport_iscsi.c static void __exit iscsi_transport_exit(void) · line 5052

Quoted 7 lines
drivers/scsi/scsi_transport_iscsi.c +1 -0
@@ -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.