All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 hulk-4.19-next 03/10] scsi:hisi_sas: fix calls to dma_set_mask_and_coherent()
       [not found] <1554778014-164225-1-git-send-email-chenxiang66@hisilicon.com>
@ 2019-04-09  2:46 ` chenxiang
  2019-04-09 15:25   ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: chenxiang @ 2019-04-09  2:46 UTC (permalink / raw)
  To: yangyingliang; +Cc: linuxarm, c00284940, stable

From: c00284940 <c00284940@huawei.com>

plinth inclusion
category: bugfix
bugzilla: NA
DTS: DTS2019030103192
CVE: NA

The change to use dma_set_mask_and_coherent() incorrectly made a second
call with the 32 bit DMA mask value when the call with the 64 bit DMA
mask value succeeded.  This resulted in FC connections failing due
to corrupted data buffers, and various other SCSI/FCP I/O errors.

Fixes: e4db40e ("scsi: hisi_sas: use dma_set_mask_and_coherent")
Cc: <stable@vger.kernel.org>

Signed-off-by: c00284940 <c00284940@huawei.com>
Reviewed-on: http://10.90.31.173:8080/4799
Tested-by: public TuringEE <turingee@huawei.com>
Reviewed-by: huangdaode 00314581 <huangdaode@hisilicon.com>
Reviewed-by: public TuringEE <turingee@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c  |  8 ++++++--
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 15 +++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 30db81d..8e9d980 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2567,6 +2567,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
 	struct Scsi_Host *shost;
 	struct hisi_hba *hisi_hba;
 	struct device *dev = &pdev->dev;
+	int error;
 
 	shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba));
 	if (!shost) {
@@ -2587,8 +2588,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
 	if (hisi_sas_get_fw_info(hisi_hba) < 0)
 		goto err_out;
 
-	if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) &&
-	    dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
+	error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
+	if (error)
+		error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
+
+	if (error) {
 		dev_err(dev, "No usable DMA addressing method\n");
 		goto err_out;
 	}
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index b4bde32..24db55f 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2903,14 +2903,13 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (rc)
 		goto err_out_disable_device;
 
-	if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) ||
-	    (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)) != 0)) {
-		if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) ||
-		   (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)) {
-			dev_err(dev, "No usable DMA addressing method\n");
-			rc = -EIO;
-			goto err_out_regions;
-		}
+	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+	if (rc)
+		rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+	if (rc) {
+		dev_err(dev, "No usable DMA addressing method\n");
+		rc = -ENODEV;
+		goto err_out_regions;
 	}
 
 	shost = hisi_sas_shost_alloc_pci(pdev);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 hulk-4.19-next 03/10] scsi:hisi_sas: fix calls to dma_set_mask_and_coherent()
  2019-04-09  2:46 ` [PATCH v2 hulk-4.19-next 03/10] scsi:hisi_sas: fix calls to dma_set_mask_and_coherent() chenxiang
@ 2019-04-09 15:25   ` Sasha Levin
  2019-04-10  1:20     ` chenxiang (M)
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2019-04-09 15:25 UTC (permalink / raw)
  To: chenxiang; +Cc: yangyingliang, linuxarm, c00284940, stable

On Tue, Apr 09, 2019 at 10:46:47AM +0800, chenxiang wrote:
>From: c00284940 <c00284940@huawei.com>
>
>plinth inclusion
>category: bugfix
>bugzilla: NA
>DTS: DTS2019030103192
>CVE: NA
>
>The change to use dma_set_mask_and_coherent() incorrectly made a second
>call with the 32 bit DMA mask value when the call with the 64 bit DMA
>mask value succeeded.  This resulted in FC connections failing due
>to corrupted data buffers, and various other SCSI/FCP I/O errors.
>
>Fixes: e4db40e ("scsi: hisi_sas: use dma_set_mask_and_coherent")
>Cc: <stable@vger.kernel.org>
>
>Signed-off-by: c00284940 <c00284940@huawei.com>
>Reviewed-on: http://10.90.31.173:8080/4799
>Tested-by: public TuringEE <turingee@huawei.com>
>Reviewed-by: huangdaode 00314581 <huangdaode@hisilicon.com>
>Reviewed-by: public TuringEE <turingee@huawei.com>

Could you please fix your scripts so it will stop sending your internal
cherry picks everywhere?


--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 hulk-4.19-next 03/10] scsi:hisi_sas: fix calls to dma_set_mask_and_coherent()
  2019-04-09 15:25   ` Sasha Levin
@ 2019-04-10  1:20     ` chenxiang (M)
  0 siblings, 0 replies; 3+ messages in thread
From: chenxiang (M) @ 2019-04-10  1:20 UTC (permalink / raw)
  To: Sasha Levin; +Cc: yangyingliang, linuxarm, c00284940, stable



在 2019/4/9 23:25, Sasha Levin 写道:
> On Tue, Apr 09, 2019 at 10:46:47AM +0800, chenxiang wrote:
>> From: c00284940 <c00284940@huawei.com>
>>
>> plinth inclusion
>> category: bugfix
>> bugzilla: NA
>> DTS: DTS2019030103192
>> CVE: NA
>>
>> The change to use dma_set_mask_and_coherent() incorrectly made a second
>> call with the 32 bit DMA mask value when the call with the 64 bit DMA
>> mask value succeeded.  This resulted in FC connections failing due
>> to corrupted data buffers, and various other SCSI/FCP I/O errors.
>>
>> Fixes: e4db40e ("scsi: hisi_sas: use dma_set_mask_and_coherent")
>> Cc: <stable@vger.kernel.org>
>>
>> Signed-off-by: c00284940 <c00284940@huawei.com>
>> Reviewed-on: http://10.90.31.173:8080/4799
>> Tested-by: public TuringEE <turingee@huawei.com>
>> Reviewed-by: huangdaode 00314581 <huangdaode@hisilicon.com>
>> Reviewed-by: public TuringEE <turingee@huawei.com>
>
> Could you please fix your scripts so it will stop sending your internal
> cherry picks everywhere?

Sorry to bother you, and i will change it

>
>
> -- 
> Thanks,
> Sasha
>
> .
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-10  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1554778014-164225-1-git-send-email-chenxiang66@hisilicon.com>
2019-04-09  2:46 ` [PATCH v2 hulk-4.19-next 03/10] scsi:hisi_sas: fix calls to dma_set_mask_and_coherent() chenxiang
2019-04-09 15:25   ` Sasha Levin
2019-04-10  1:20     ` chenxiang (M)

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.