From patchwork Tue Oct 25 13:42:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 79176 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp3121251qge; Tue, 25 Oct 2016 06:43:18 -0700 (PDT) X-Received: by 10.98.28.206 with SMTP id c197mr39539391pfc.113.1477402998678; Tue, 25 Oct 2016 06:43:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c141si20690885pfc.102.2016.10.25.06.43.18; Tue, 25 Oct 2016 06:43:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935062AbcJYNnQ (ORCPT + 10 others); Tue, 25 Oct 2016 09:43:16 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:34835 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933363AbcJYNnQ (ORCPT ); Tue, 25 Oct 2016 09:43:16 -0400 Received: by mail-wm0-f47.google.com with SMTP id c78so164240446wme.0 for ; Tue, 25 Oct 2016 06:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=k98M4hgoucujcD5BBpZqM2y/1bnNhApR7RXtpBsEOf4=; b=AymOzhD+6WJr7Usc3m0osYOEcOcttQXj/nUYCOXdUmb8fFyccVR+s0pHpI5cOLts+c Jgw3bGhSSPnCd2b+A6lo3OOXhQjR3Bhbk6SzJRwjEYf5VPh35XOmVxeyseODrLZ19zLO KgX2phMRnHBskZ9qCUtP//C8uI0QH0qhGWkRE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=k98M4hgoucujcD5BBpZqM2y/1bnNhApR7RXtpBsEOf4=; b=JtOee9q/C6gK5ixPuv4gMpm7w5vF+3/D3AZkkRKDVJs47X04fed5+OQ55f4QB3AHA9 qAqbRjZD50x44ZUkZ8hOU5QwtfTnqqr0Nb+W0Hd8Gcp2qFzHIEJ22k6WZV37X5//p1Tu wdfOAkIXIPwLOEP0ep3YPm+LiMs5/a8euJXc72MJ3Xh2ESvqonqwO9dw6r+/QMF+Ccg+ 4R4gps3/aPCPZjqG2clqQeozxm7Moi8RrLg9zjoMzBe34lfnvlvbJj0iSrWUAHfQK9u+ AGzC0bu8MtfeaCMEjGnOi2xSEer8oyrso6MkdUf7Km68EubDzOxBTQOzfTKWJWc0Yy5e MUxw== X-Gm-Message-State: ABUngvfBRJAsIoIPVNYaacvf0YZdm8Fai128RnJ6AZ6zz1Uciik9xyg0oM+2cah0IQtW+U4z X-Received: by 10.28.222.70 with SMTP id v67mr3222471wmg.84.1477402994445; Tue, 25 Oct 2016 06:43:14 -0700 (PDT) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id 18sm3791538wmr.6.2016.10.25.06.43.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Oct 2016 06:43:13 -0700 (PDT) From: Srinivas Kandagatla To: svarbanov@mm-sol.com, bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, srinivas.kandagatla@linaro.org Subject: [PATCH] PCI: qcom: fix NULL pointer dereference in get_resources() Date: Tue, 25 Oct 2016 14:42:51 +0100 Message-Id: <1477402971-22146-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 Fixes: e6a087eeaf91 ("PCI: qcom: Remove redundant struct qcom_pcie.dev") --- drivers/pci/host/pcie-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;