]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
PCI: exynos: Fix a potential init_clk_resources NULL pointer dereference
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 22 Jan 2018 02:28:54 +0000 (11:28 +0900)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Feb 2019 04:53:01 +0000 (04:53 +0000)
BugLink: http://bugs.launchpad.net/bugs/1811877
commit b5d6bc90c9129279d363ccbc02ad11e7b657c0b4 upstream.

In order to avoid triggering a NULL pointer dereference in
exynos_pcie_probe() a check must be put in place to detect if
the init_clk_resources hook is initialized before calling it.

Add the respective function pointer check in exynos_pcie_probe().

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
[lorenzo.pieralisi@arm.com: rewrote the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/pci/dwc/pci-exynos.c

index 5596fdedbb9471c49b4bb73fbc57b5b03170521f..ea03f1ec12a47713f3633816cb6216a92965a629 100644 (file)
@@ -695,7 +695,8 @@ static int __init exynos_pcie_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       if (ep->ops && ep->ops->get_clk_resources) {
+       if (ep->ops && ep->ops->get_clk_resources &&
+                       ep->ops->init_clk_resources) {
                ret = ep->ops->get_clk_resources(ep);
                if (ret)
                        return ret;