PCI: exynos: fix the potential null pointer dereference
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20180122022856epcas1p494a9efeae478b299e3e8006adad71e6a@epcas1p4.samsung.com
PATCH 1/1 PCI: exynos: fix the potential null pointer dereference
Before calling the callback function, it needs to check whether init_clk_resources is assigned or not.
Otherwise, it can be occurred the NULL pointer dereference when init_clk_resources is not assigned.
Even though init_clk_resources is assigned now, it needs to prevent the potential NULL pointer dereference in future.
--- drivers/pci/dwc/pci-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/dwc/pci-exynos.c +2 -1
@@ -499,7 +499,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;
Signature · 1 line
2.15.1
PATCH 1/1 PCI: exynos: fix the potential null pointer dereference
Quoted 10 lines · Jaehoon Chung
Before calling the callback function, it needs to check whether
init_clk_resourcesis assigned or not.
Otherwise, it can be occurred the NULL pointer dereference wheninit_clk_resourcesis not assigned.Even though
init_clk_resourcesis assigned now, it needs to prevent the potential NULL pointer dereference in future.Signed-off-by Jaehoon Chung <[email protected]>
Best regards,
Jingoo Han
Quoted 21 lines
--- drivers/pci/dwc/pci-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/dwc/pci-exynos.c +2
-1@@ -499,7 +499,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;
--
2.15.1
Lorenzo Pieralisi
AppliedPATCH 1/1 PCI: exynos: fix the potential null pointer dereference
In reply to Jaehoon ChungQuoted 29 lines · Jaehoon Chung
Before calling the callback function, it needs to check whether
init_clk_resourcesis assigned or not.
Otherwise, it can be occurred the NULL pointer dereference wheninit_clk_resourcesis not assigned.Even though
init_clk_resourcesis assigned now, it needs to prevent the potential NULL pointer dereference in future.Signed-off-by Jaehoon Chung <[email protected]>--- drivers/pci/dwc/pci-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/dwc/pci-exynos.c +2
-1@@ -499,7 +499,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;Signature · 1 line
2.15.1
I applied it to pci/dwc for 4.16.
Thanks,
Lorenzo