summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJustin Tee <justin.tee@broadcom.com>2023-03-02 00:16:18 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2023-03-10 03:21:44 +0100
commitbf21c9bb624c85f499be271cc1b3d41bec50f7bd (patch)
tree458dcb11eb4ac9ee54d214bc05c7e1dec9a7a463 /drivers/scsi/lpfc/lpfc_sli.c
parentscsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow (diff)
downloadlinux-bf21c9bb624c85f499be271cc1b3d41bec50f7bd.tar.xz
linux-bf21c9bb624c85f499be271cc1b3d41bec50f7bd.zip
scsi: lpfc: Reorder freeing of various DMA buffers and their list removal
Code sections where DMA resources are freed before list removal are reworked to ensure item removal before being freed. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20230301231626.9621-3-justintee8345@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index c5b69f313af3..bfab1f0fb3f0 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -22329,10 +22329,10 @@ lpfc_free_sgl_per_hdwq(struct lpfc_hba *phba,
/* Free sgl pool */
list_for_each_entry_safe(list_entry, tmp,
buf_list, list_node) {
+ list_del(&list_entry->list_node);
dma_pool_free(phba->lpfc_sg_dma_buf_pool,
list_entry->dma_sgl,
list_entry->dma_phys_sgl);
- list_del(&list_entry->list_node);
kfree(list_entry);
}
@@ -22479,10 +22479,10 @@ lpfc_free_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,
list_for_each_entry_safe(list_entry, tmp,
buf_list,
list_node) {
+ list_del(&list_entry->list_node);
dma_pool_free(phba->lpfc_cmd_rsp_buf_pool,
list_entry->fcp_cmnd,
list_entry->fcp_cmd_rsp_dma_handle);
- list_del(&list_entry->list_node);
kfree(list_entry);
}