diff mbox

bfa: fix leak of bfad_im_port_index on module unload

Message ID 1434063045-17480-1-git-send-email-khoroshilov@ispras.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexey Khoroshilov June 11, 2015, 10:50 p.m. UTC
Resources allocated within bfad_im_port_index idr are not deallocated
on module unload. The patch adds idr_destroy() in exit function.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/scsi/bfa/bfad_im.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Johannes Thumshirn June 12, 2015, 3:09 p.m. UTC | #1
On Fri, Jun 12, 2015 at 01:50:45AM +0300, Alexey Khoroshilov wrote:
> Resources allocated within bfad_im_port_index idr are not deallocated
> on module unload. The patch adds idr_destroy() in exit function.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>  drivers/scsi/bfa/bfad_im.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
> index 7223b0006740..8367c11d554b 100644
> --- a/drivers/scsi/bfa/bfad_im.c
> +++ b/drivers/scsi/bfa/bfad_im.c
> @@ -851,6 +851,8 @@ bfad_im_module_exit(void)
>  
>  	if (bfad_im_scsi_vport_transport_template)
>  		fc_release_transport(bfad_im_scsi_vport_transport_template);
> +
> +	idr_destroy(&bfad_im_port_index);
>  }
>  
>  void
> -- 
> 1.9.1
> 

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 7223b0006740..8367c11d554b 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -851,6 +851,8 @@  bfad_im_module_exit(void)
 
 	if (bfad_im_scsi_vport_transport_template)
 		fc_release_transport(bfad_im_scsi_vport_transport_template);
+
+	idr_destroy(&bfad_im_port_index);
 }
 
 void