diff mbox series

scsi: sd: fix sd ida memory leak

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

Commit Message

Guixin Liu Jan. 29, 2024, 9:02 a.m. UTC
The sd_index_ida should be destroy when the sd module exit.

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

Comments

Benjamin Block Feb. 7, 2024, 10:54 a.m. UTC | #1
On Mon, Jan 29, 2024 at 05:02:34PM +0800, Guixin Liu wrote:
> The sd_index_ida should be destroy when the sd module exit.
> 
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>  drivers/scsi/sd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 0833b3e6aa6e..8b88cba88da2 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -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.


Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
diff mbox series

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0833b3e6aa6e..8b88cba88da2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -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);