linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: exynos: fix the NULL pointer dereference about elbi_base
       [not found] <CGME20170307105407epcas5p3e77181793b26a5d2710bb6d7557033bb@epcas5p3.samsung.com>
@ 2017-03-07 10:54 ` Jaehoon Chung
  2017-03-07 18:52   ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Jaehoon Chung @ 2017-03-07 10:54 UTC (permalink / raw)
  To: linux-pci; +Cc: linux-kernel, helgaas, jingoohan1, Jaehoon Chung

Even though using phy framework, it has to get the elbi_base.
Before this patch, elbi_base should be NULL pointer.

Fixes: e7cd7ef58e1f ("PCI: exynos: Support the PHY generic framework")

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/pci/dwc/pci-exynos.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c
index 993b650..44f774c 100644
--- a/drivers/pci/dwc/pci-exynos.c
+++ b/drivers/pci/dwc/pci-exynos.c
@@ -132,10 +132,6 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
 	struct device *dev = pci->dev;
 	struct resource *res;
 
-	/* If using the PHY framework, doesn't need to get other resource */
-	if (ep->using_phy)
-		return 0;
-
 	ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
 	if (!ep->mem_res)
 		return -ENOMEM;
@@ -145,6 +141,10 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
 	if (IS_ERR(ep->mem_res->elbi_base))
 		return PTR_ERR(ep->mem_res->elbi_base);
 
+	/* If using the PHY framework, doesn't need to get other resource */
+	if (ep->using_phy)
+		return 0;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	ep->mem_res->phy_base = devm_ioremap_resource(dev, res);
 	if (IS_ERR(ep->mem_res->phy_base))
-- 
2.10.2

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

* Re: [PATCH] PCI: exynos: fix the NULL pointer dereference about elbi_base
  2017-03-07 10:54 ` [PATCH] PCI: exynos: fix the NULL pointer dereference about elbi_base Jaehoon Chung
@ 2017-03-07 18:52   ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2017-03-07 18:52 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-pci, linux-kernel, jingoohan1

On Tue, Mar 07, 2017 at 07:54:05PM +0900, Jaehoon Chung wrote:
> Even though using phy framework, it has to get the elbi_base.
> Before this patch, elbi_base should be NULL pointer.
> 
> Fixes: e7cd7ef58e1f ("PCI: exynos: Support the PHY generic framework")
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

Provisionally applied to for-linus for v4.11, pending Jingoo's ack.
Thanks, Jaehoon!

> ---
>  drivers/pci/dwc/pci-exynos.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c
> index 993b650..44f774c 100644
> --- a/drivers/pci/dwc/pci-exynos.c
> +++ b/drivers/pci/dwc/pci-exynos.c
> @@ -132,10 +132,6 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
>  	struct device *dev = pci->dev;
>  	struct resource *res;
>  
> -	/* If using the PHY framework, doesn't need to get other resource */
> -	if (ep->using_phy)
> -		return 0;
> -
>  	ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
>  	if (!ep->mem_res)
>  		return -ENOMEM;
> @@ -145,6 +141,10 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
>  	if (IS_ERR(ep->mem_res->elbi_base))
>  		return PTR_ERR(ep->mem_res->elbi_base);
>  
> +	/* If using the PHY framework, doesn't need to get other resource */
> +	if (ep->using_phy)
> +		return 0;
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>  	ep->mem_res->phy_base = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(ep->mem_res->phy_base))
> -- 
> 2.10.2
> 

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

end of thread, other threads:[~2017-03-07 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170307105407epcas5p3e77181793b26a5d2710bb6d7557033bb@epcas5p3.samsung.com>
2017-03-07 10:54 ` [PATCH] PCI: exynos: fix the NULL pointer dereference about elbi_base Jaehoon Chung
2017-03-07 18:52   ` 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).