linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: qcom: fix NULL pointer dereference in get_resources()
@ 2016-10-25 13:42 Srinivas Kandagatla
  2016-10-26 19:50 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Kandagatla @ 2016-10-25 13:42 UTC (permalink / raw)
  To: svarbanov, bhelgaas; +Cc: linux-pci, linux-arm-msm, srinivas.kandagatla

get_resources() will dereference dev as NULL pointer when called from probe(),
as pp.dev is only assigned after get_resources() is called.

Fix this by moving dev pointer assignment before get_resources() call.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fixes: e6a087eeaf91 ("PCI: qcom: Remove redundant struct qcom_pcie.dev")
---
 drivers/pci/host/pcie-qcom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c
index ef0a84c..3593640 100644
--- a/drivers/pci/host/pcie-qcom.c
+++ b/drivers/pci/host/pcie-qcom.c
@@ -533,11 +533,11 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	if (IS_ERR(pcie->phy))
 		return PTR_ERR(pcie->phy);
 
+	pp->dev = dev;
 	ret = pcie->ops->get_resources(pcie);
 	if (ret)
 		return ret;
 
-	pp->dev = dev;
 	pp->root_bus_nr = -1;
 	pp->ops = &qcom_pcie_dw_ops;
 
-- 
2.10.1


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

end of thread, other threads:[~2016-10-26 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-25 13:42 [PATCH] PCI: qcom: fix NULL pointer dereference in get_resources() Srinivas Kandagatla
2016-10-26 19:50 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).