diff mbox

scsi_debug: Fix memory leak if LBP enabled and module is unloaded

Message ID 1477495373-1179-1-git-send-email-emilne@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Ewan Milne Oct. 26, 2016, 3:22 p.m. UTC
From: "Ewan D. Milne" <emilne@redhat.com>

map_storep was not being vfree()'d in the module_exit call.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
 drivers/scsi/scsi_debug.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurence Oberman Oct. 26, 2016, 4:56 p.m. UTC | #1
----- Original Message -----
> From: "Ewan D. Milne" <emilne@redhat.com>
> To: linux-scsi@vger.kernel.org
> Sent: Wednesday, October 26, 2016 11:22:53 AM
> Subject: [PATCH] scsi_debug: Fix memory leak if LBP enabled and module is unloaded
> 
> From: "Ewan D. Milne" <emilne@redhat.com>
> 
> map_storep was not being vfree()'d in the module_exit call.
> 
> Signed-off-by: Ewan D. Milne <emilne@redhat.com>
> ---
>  drivers/scsi/scsi_debug.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index c905709..cf04a36 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -5134,6 +5134,7 @@ static void __exit scsi_debug_exit(void)
>  	bus_unregister(&pseudo_lld_bus);
>  	root_device_unregister(pseudo_primary);
>  
> +	vfree(map_storep);
>  	vfree(dif_storep);
>  	vfree(fake_storep);
>  	kfree(sdebug_q_arr);
> --
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Looks fine
Reviewed-by: Laurence Oberman <loberman@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen Oct. 27, 2016, 2:11 a.m. UTC | #2
>>>>> "Ewan" == Ewan D Milne <emilne@redhat.com> writes:

Ewan> map_storep was not being vfree()'d in the module_exit call.

Applied to 4.9/scsi-fixes.
diff mbox

Patch

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c905709..cf04a36 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -5134,6 +5134,7 @@  static void __exit scsi_debug_exit(void)
 	bus_unregister(&pseudo_lld_bus);
 	root_device_unregister(pseudo_primary);
 
+	vfree(map_storep);
 	vfree(dif_storep);
 	vfree(fake_storep);
 	kfree(sdebug_q_arr);