aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/renesas/sh_eth.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2013-10-30 16:30:19 -0400
committerDavid S. Miller <davem@davemloft.net>2013-11-04 15:49:28 -0500
commit3b4c5cbf42bda976ab70354e7786a0808265d9d5 (patch)
treeee60ea2b60d9dfb382f509722c6564d51d920958 /drivers/net/ethernet/renesas/sh_eth.c
parent6f9fed0bd2f82bafe1d8ab200916d9bd55b36c66 (diff)
sh_eth: check platform data pointer
Check the platform data pointer before dereferencing it and error out of the probe() method if it's NULL. This has additional effect of preventing kernel oops with outdated platform data containing zero PHY address instead (such as on SolutionEngine7710). Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/renesas/sh_eth.c')
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index eaf11e47334f..d256ce19d4de 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2663,6 +2663,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
2663 pm_runtime_enable(&pdev->dev); 2663 pm_runtime_enable(&pdev->dev);
2664 pm_runtime_resume(&pdev->dev); 2664 pm_runtime_resume(&pdev->dev);
2665 2665
2666 if (!pd) {
2667 dev_err(&pdev->dev, "no platform data\n");
2668 ret = -EINVAL;
2669 goto out_release;
2670 }
2671
2666 /* get PHY ID */ 2672 /* get PHY ID */
2667 mdp->phy_id = pd->phy; 2673 mdp->phy_id = pd->phy;
2668 mdp->phy_interface = pd->phy_interface; 2674 mdp->phy_interface = pd->phy_interface;