Skip to contentSkip to conversation

scsi: sd: fix sd ida memory leak

PATCH In review Guixin Liu 2 participants 2 messages Jan 29, 2024 – Feb 7, 2024 SCSI

lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

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

The sd_index_ida should be destroy when the sd module exit.

---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/sd.c +2 -0
index 0833b3e6aa6e..8b88cba88da2 100644
@@ -4079,6 +4079,8 @@ static void __exit exit_sd(void)
 
 	for (i = 0; i < SD_MAJORS; i++)
 		unregister_blkdev(sd_major(i), "sd");
+
+	ida_destroy(&sd_index_ida);
 }
 
 module_init(init_sd);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Guixin Liu

The sd_index_ida should be destroy when the sd module exit.

---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/sd.c +0 -0
index 0833b3e6aa6e..8b88cba88da2 100644

drivers/scsi/sd.c static void __exit exit_sd(void) · line 4083

Quoted 5 lines
drivers/scsi/sd.c +2 -0
@@ -4079,6 +4079,8 @@ static void __exit exit_sd(void)
 
 	for (i = 0; i < SD_MAJORS; i++)
 		unregister_blkdev(sd_major(i), "sd");
+
+	ida_destroy(&sd_index_ida);

Looks good to me.

Signature · 4 lines
Best Regards, Benjamin Block        /        Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH    /   https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt         /        Geschäftsführung: David Faller
Sitz der Ges.: Böblingen     /    Registergericht: AmtsG Stuttgart, HRB 243294