lpfc: potential leak in lpfc_sli_hbqbuf_fill_hbqs
Subsystems (2)
PATCH 1/1 lpfc: potential leak in lpfc_sli_hbqbuf_fill_hbqs
If lpfc_hbq_alloc() fails, an hbq_buffer is leaked. Found by Coverity (1775).
---
drivers/scsi/lpfc/lpfc_sli.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +0 -0
@@ -622,8 +622,10 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
return 1;
hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI,
&hbq_buffer->dbuf.phys);
- if (hbq_buffer->dbuf.virt == NULL)
+ if (hbq_buffer->dbuf.virt == NULL) {
+ kfree(hbq_buffer);
return 1;
+ }
hbq_buffer->tag = (i | (hbqno << 16));
lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer);
lpfc_hbq_defs[hbqno]->buffer_count++;Florin,
Thanks for the effort to create this patch. Turns out we have already fixed this, and have it included in our 8.2.2 patch set, which we will be posting within the next week.
So James, don't pick this patch up, take the larger patch set instead.
Thanks.
-- james s
Quoted 27 lines · Florin Malita
If
lpfc_hbq_alloc()fails, anhbq_bufferis leaked. Found by Coverity (1775).Signed-off-by Florin Malita <[email protected]>---
drivers/scsi/lpfc/lpfc_sli.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_sli.c +3
-1@@ -622,8 +622,10 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count) return 1; hbq_buffer->dbuf.virt =lpfc_hbq_alloc (phba,MEM_PRI , &hbq_buffer->dbuf.phys); -if (hbq_buffer->dbuf.virt ==NULL ) +if (hbq_buffer->dbuf.virt ==NULL ) { +kfree (hbq_buffer);return 1 ; + } hbq_buffer->tag = (i | (hbqno <<16 ));lpfc_sli_hbq_to_firmware (phba, hbqno, hbq_buffer);lpfc_hbq_defs[hbqno]->buffer_count++;
Quoted 5 lines · James Smart
Florin,
Thanks for the effort to create this patch. Turns out we have already fixed this, and have it included in our 8.2.2 patch set, which we will be posting within the next week.
The 2.6.23 merge window is estimated to close on Sunday (22 July) ...
Quoted 1 line
So James, don't pick this patch up, take the larger patch set instead.
OK, will wait.
James