* [PATCH 1/4] scsi: pm8001: fix a memory leak in nvmd_resp
@ 2014-07-07 15:19 Tomas Henzl
2014-07-10 10:25 ` Suresh Thiagarajan
0 siblings, 1 reply; 2+ messages in thread
From: Tomas Henzl @ 2014-07-07 15:19 UTC (permalink / raw)
To: linux-scsi
Cc: xjtuwjp, Vasanthalakshmi.Tharmarajan, Suresh.Thiagarajan,
Viswas.G, Tomas Henzl
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>
---
drivers/scsi/pm8001/pm8001_hwi.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index cacb429..dc70791 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -3129,7 +3129,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);
@@ -3138,7 +3137,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) {
@@ -3179,13 +3177,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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH 1/4] scsi: pm8001: fix a memory leak in nvmd_resp
2014-07-07 15:19 [PATCH 1/4] scsi: pm8001: fix a memory leak in nvmd_resp Tomas Henzl
@ 2014-07-10 10:25 ` Suresh Thiagarajan
0 siblings, 0 replies; 2+ messages in thread
From: Suresh Thiagarajan @ 2014-07-10 10:25 UTC (permalink / raw)
To: Tomas Henzl, linux-scsi; +Cc: xjtuwjp, Vasanthalakshmi Tharmarajan, Viswas G
On Mon, Jul 7, 2014 at 8:49 PM, Tomas Henzl <thenzl@redhat.com> wrote:
> 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.
Looks good. Thanks Tomas.
Acked-by: Suresh Thiagarajan<Suresh.Thiagarajan@pmcs.com>
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> ---
> drivers/scsi/pm8001/pm8001_hwi.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index cacb429..dc70791 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -3129,7 +3129,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);
> @@ -3138,7 +3137,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) {
> @@ -3179,13 +3177,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)
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-10 10:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07 15:19 [PATCH 1/4] scsi: pm8001: fix a memory leak in nvmd_resp Tomas Henzl
2014-07-10 10:25 ` Suresh Thiagarajan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.