pm8001: fix a memory leak in nvmd_resp
authorTomas Henzl <thenzl@redhat.com>
Mon, 7 Jul 2014 15:19:58 +0000 (17:19 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 Jul 2014 21:17:05 +0000 (17:17 -0400)
Instead of copying information to fw_control_context free it.

The task is forgotten thus also the reference to fw_control_context
and the completion thread takes the info from virt_ptr again.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/pm8001/pm8001_hwi.c

index 2e5eb4b..1738310 100644 (file)
@@ -3132,7 +3132,6 @@ void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 void
 pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
 {
-       struct fw_control_ex    *fw_control_context;
        struct get_nvm_data_resp *pPayload =
                (struct get_nvm_data_resp *)(piomb + 4);
        u32 tag = le32_to_cpu(pPayload->tag);
@@ -3141,7 +3140,6 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
        u32 ir_tds_bn_dps_das_nvm =
                le32_to_cpu(pPayload->ir_tda_bn_dps_das_nvm);
        void *virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr;
-       fw_control_context = ccb->fw_control_context;
 
        PM8001_MSG_DBG(pm8001_ha, pm8001_printk("Get nvm data complete!\n"));
        if ((dlen_status & NVMD_STAT) != 0) {
@@ -3182,13 +3180,11 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
                        pm8001_printk("Get NVMD success, IR=0, dataLen=%d\n",
                        (dlen_status & NVMD_LEN) >> 24));
        }
-       memcpy(fw_control_context->usrAddr,
-               pm8001_ha->memoryMap.region[NVMD].virt_ptr,
-               fw_control_context->len);
-       complete(pm8001_ha->nvmd_completion);
+       kfree(ccb->fw_control_context);
        ccb->task = NULL;
        ccb->ccb_tag = 0xFFFFFFFF;
        pm8001_tag_free(pm8001_ha, tag);
+       complete(pm8001_ha->nvmd_completion);
 }
 
 int pm8001_mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha, void *piomb)