Skip to contentSkip to conversation

IB/qib: fix uninitialized pointer if CONFIG_PCI_MSI not set

PATCH In review Ralph Campbell 3 participants 8 messages Oct 22, 2010 – Oct 26, 2010 6 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 IB/qib: fix uninitialized pointer if CONFIG_PCI_MSI not set

If CONFIG_PCI_MSI is not set, and a QLE7140 is present, the pointer "dd" was uninitialized.

---

 drivers/infiniband/hw/qib/qib_init.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/infiniband/hw/qib/qib_init.c +1 -0
index f1d16d3..f3b5039 100644
@@ -1243,6 +1243,7 @@ static int __devinit qib_init_one(struct pci_dev *pdev,
 		qib_early_err(&pdev->dev, "QLogic PCIE device 0x%x cannot "
 		      "work if CONFIG_PCI_MSI is not enabled\n",
 		      ent->device);
+		dd = ERR_PTR(-ENODEV);
 #endif
 		break;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20101022222937.28161.50341.stgit-/[email protected]

#2 lore raw

PATCH 2/2 IB/qib: Allow driver to load if PCIe advanced error reporting fails

Some PCIe root complex chip sets don't support advanced error reporting. Allow the driver to load OK if pci_enable_pcie_error_reporting() fails.

---

 drivers/infiniband/hw/qib/qib_pcie.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/infiniband/hw/qib/qib_pcie.c +3 -1
index 7fa6e55..8a64426 100644
@@ -109,10 +109,12 @@ int qib_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	pci_set_master(pdev);
 	ret = pci_enable_pcie_error_reporting(pdev);
-	if (ret)
+	if (ret) {
 		qib_early_err(&pdev->dev,
 			      "Unable to enable pcie error reporting: %d\n",
 			      ret);
+		ret = 0;
+	}
 	goto done;
 
 bail:

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20101022222951.28161.23347.stgit-/[email protected]

#4 lore raw

Re: [PATCH 2/2] IB/qib: Allow driver to load if PCIe advanced error reporting fails

Quoted 2 lines · Ralph Campbell

Some PCIe root complex chip sets don't support advanced error reporting. Allow the driver to load OK if pci_enable_pcie_error_reporting() fails.

Thanks

If you use this solution you'll want this hunk as well to avoid a leak:

drivers/infiniband/hw/qib/qib_pcie.c +3 -1
index 16ce9e7..2913af2 100644
@@ -103,9 +103,11 @@ int qib_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)
                ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
        } else
                ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-       if (ret)
+       if (ret) {
                qib_early_err(&pdev->dev,
                              "Unable to set DMA consistent mask: %d\n", ret);
+               goto bail;
+       }
 
        pci_set_master(pdev);
        ret = pci_enable_pcie_error_reporting(pdev);

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20101022225710.GD15514-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] IB/qib: Allow driver to load if PCIe advanced error reporting fails

I'm lost on which initialization / cleanup fixes are the right ones to take for qib. Can someone point me to the definitive set of patches?

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH 2/2] IB/qib: Allow driver to load if PCIe advanced error reporting fails

Quoted 4 lines · Roland Dreier

I'm lost on which initialization / cleanup fixes are the right ones to take for qib. Can someone point me to the definitive set of patches?

- R.

If Jason agrees, they are the attached. There are probably more error paths that need fixing but I think separate patches make sense for those.

If CONFIG_PCI_MSI is not set, and a QLE7140 is present, the pointer "dd" was uninitialized.

---

 drivers/infiniband/hw/qib/qib_init.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/infiniband/hw/qib/qib_init.c +1 -0
index f1d16d3..f3b5039 100644
@@ -1243,6 +1243,7 @@ static int __devinit qib_init_one(struct pci_dev *pdev,
 		qib_early_err(&pdev->dev, "QLogic PCIE device 0x%x cannot "
 		      "work if CONFIG_PCI_MSI is not enabled\n",
 		      ent->device);
+		dd = ERR_PTR(-ENODEV);
 #endif
 		break;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Some PCIe root complex chip sets don't support advanced error reporting. Allow the driver to load OK if pci_enable_pcie_error_reporting() fails.

---

 drivers/infiniband/hw/qib/qib_pcie.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/infiniband/hw/qib/qib_pcie.c +3 -1
index 7fa6e55..8a64426 100644
@@ -109,10 +109,12 @@ int qib_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	pci_set_master(pdev);
 	ret = pci_enable_pcie_error_reporting(pdev);
-	if (ret)
+	if (ret) {
 		qib_early_err(&pdev->dev,
 			      "Unable to enable pcie error reporting: %d\n",
 			      ret);
+		ret = 0;
+	}
 	goto done;
 
 bail:

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Clean up properly if pci_set_consistent_dma_mask() fails.

---

 drivers/infiniband/hw/qib/qib_pcie.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/infiniband/hw/qib/qib_pcie.c +3 -1
index 8a64426..48b6674 100644
@@ -103,9 +103,11 @@ int qib_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)
 		ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
 	} else
 		ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
-	if (ret)
+	if (ret) {
 		qib_early_err(&pdev->dev,
 			      "Unable to set DMA consistent mask: %d\n", ret);
+		goto bail;
+	}
 
 	pci_set_master(pdev);
 	ret = pci_enable_pcie_error_reporting(pdev);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1288038933.27343.392.camel-/[email protected]

#10 lore raw

Re: [PATCH 2/2] IB/qib: Allow driver to load if PCIe advanced error reporting fails

Quoted 7 lines · Ralph Campbell
Quoted 2 lines · Roland Dreier

I'm lost on which initialization / cleanup fixes are the right ones to take for qib. Can someone point me to the definitive set of patches?

If Jason agrees, they are the attached. There are probably more error paths that need fixing but I think separate patches make sense for those.

Yes, there are more error paths that leak things, but this fixes up some obvious ones and makes the driver work (and not leak) on older PCI-E systems.

Please include the 3 patches from Ralph in this round.

Thanks,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

Re: [PATCH 2/2] IB/qib: Allow driver to load if PCIe advanced error reporting fails

Quoted 1 line · Roland Dreier

OK, I got those 3 patches.

Thanks

While you are looking at patches, did you have any comment on:

https://patchwork.kernel.org/patch/151491/
https://patchwork.kernel.org/patch/151501/

?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html