From: James Smart Date: Fri, 22 May 2015 14:42:39 +0000 (-0400) Subject: lpfc: Fix scsi prep dma buf error. X-Git-Tag: v4.1.12-92~249^2~3^2~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=729dab390e0e4760683366649483276ba42e7a76;p=users%2Fjedix%2Flinux-maple.git lpfc: Fix scsi prep dma buf error. Didn't check for less-than-or-equal zero. Means we may later call scsi_dma_unmap() even though we don't have valid mappings. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke Signed-off-by: James Bottomley (cherry picked from commit 5116fbf136ea21b8678a85eee5c03508736ada9f) Orabug: 22029622 From dick.kennedy@avagotech.com lpfc-10.5.0.1-11.0.0.3-1.tar.gz Acked-by: Chuck Anderson --- diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index e20cd08326c56..3aa2b11049fda 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -3257,7 +3257,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) */ nseg = scsi_dma_map(scsi_cmnd); - if (unlikely(!nseg)) + if (unlikely(nseg <= 0)) return 1; sgl += 1; /* clear the last flag in the fcp_rsp map entry */