From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:40671 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752434AbbINObM (ORCPT ); Mon, 14 Sep 2015 10:31:12 -0400 From: Jiri Slaby To: stable@vger.kernel.org Cc: James Smart , Dick Kennedy , James Bottomley , Jiri Slaby Subject: [patch added to the 3.12 stable tree] lpfc: Fix scsi prep dma buf error. Date: Mon, 14 Sep 2015 16:31:02 +0200 Message-Id: <1442241067-32390-3-git-send-email-jslaby@suse.cz> In-Reply-To: <1442241067-32390-1-git-send-email-jslaby@suse.cz> References: <1442241067-32390-1-git-send-email-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org List-ID: From: James Smart This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit 5116fbf136ea21b8678a85eee5c03508736ada9f upstream. 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 Signed-off-by: Jiri Slaby --- drivers/scsi/lpfc/lpfc_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c913e8cc3b26..ed7759980c47 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -3423,7 +3423,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 */ -- 2.5.2