From: Parikh, Neerav Date: Fri, 25 Feb 2011 23:02:51 +0000 (-0800) Subject: [SCSI] libfc: Fixing a memory leak when destroying an interface X-Git-Tag: v2.6.39-rc1~440^2~18 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fe5e3f1aec310779a4b830022a26842b8d587228;p=karo-tx-linux.git [SCSI] libfc: Fixing a memory leak when destroying an interface When an fcoe interface is being destroyed; in the process the fcoe driver will try to release all the resources it had allocated for that interface including rports. But, it seems that it does not release the reference held for the name server rport in that process resulting into a memory leak. This patch fixes that memory leak. Signed-off-by: Neerav Parikh Tested-by: Ross Brattain Signed-off-by: Robert Love Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index 59b16bbb66a3..49e1ccca09d5 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c @@ -357,6 +357,7 @@ static void fc_rport_work(struct work_struct *work) if (port_id == FC_FID_DIR_SERV) { rdata->event = RPORT_EV_NONE; mutex_unlock(&rdata->rp_mutex); + kref_put(&rdata->kref, lport->tt.rport_destroy); } else if ((rdata->flags & FC_RP_STARTED) && rdata->major_retries < lport->max_rport_retry_count) {