diff mbox series

[RESEND,1/2] scsi: libfc: free response frame from GPN_ID

Message ID 1579013000-14570-2-git-send-email-igor.druzhinin@citrix.com (mailing list archive)
State Accepted
Headers show
Series Fixing libfc memory leaks | expand

Commit Message

Igor Druzhinin Jan. 14, 2020, 2:43 p.m. UTC
fc_disc_gpn_id_resp() should be the last function using it so free it
here to avoid memory leak.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 drivers/scsi/libfc/fc_disc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Hannes Reinecke Feb. 21, 2020, 9:18 a.m. UTC | #1
On 1/14/20 3:43 PM, Igor Druzhinin wrote:
> fc_disc_gpn_id_resp() should be the last function using it so free it
> here to avoid memory leak.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> ---
>  drivers/scsi/libfc/fc_disc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
> index 9c5f7c9..2b865c6 100644
> --- a/drivers/scsi/libfc/fc_disc.c
> +++ b/drivers/scsi/libfc/fc_disc.c
> @@ -628,6 +628,8 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
>  	}
>  out:
>  	kref_put(&rdata->kref, fc_rport_destroy);
> +	if (!IS_ERR(fp))
> +		fc_frame_free(fp);
>  }
>  
>  /**
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Martin K. Petersen Feb. 21, 2020, 10:56 p.m. UTC | #2
Igor,

> fc_disc_gpn_id_resp() should be the last function using it so free it
> here to avoid memory leak.

Applied to 5.6/scsi-fixes, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 9c5f7c9..2b865c6 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -628,6 +628,8 @@  static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
 	}
 out:
 	kref_put(&rdata->kref, fc_rport_destroy);
+	if (!IS_ERR(fp))
+		fc_frame_free(fp);
 }
 
 /**