projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3e60b74
)
net: ethernet: mediatek: get out of potential invalid pointer access
author
Sean Wang
<
[email protected]
>
Thu, 22 Sep 2016 08:44:16 +0000
(16:44 +0800)
committer
David S. Miller
<
[email protected]
>
Thu, 22 Sep 2016 12:22:28 +0000
(08:22 -0400)
Potential dangerous invalid pointer might be accessed if
the error happens when couple phy_device to net_device so
cleanup the error path.
Signed-off-by: Sean Wang <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
drivers/net/ethernet/mediatek/mtk_eth_soc.c
patch
|
blob
|
history
diff --git
a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a65801a5e2eede284bf631958638a2c11af01236..3d7e0cb601b658e13f16af717b5d30101321cf4f 100644
(file)
--- a/
drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/
drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@
-296,7
+296,9
@@
static int mtk_phy_connect(struct net_device *dev)
regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
/* couple phydev to net_device */
- mtk_phy_connect_node(eth, mac, np);
+ if (mtk_phy_connect_node(eth, mac, np))
+ goto err_phy;
+
dev->phydev->autoneg = AUTONEG_ENABLE;
dev->phydev->speed = 0;
dev->phydev->duplex = 0;
@@
-317,7
+319,7
@@
static int mtk_phy_connect(struct net_device *dev)
err_phy:
of_node_put(np);
- dev_err(eth->dev, "
invalid phy_mode\n"
);
+ dev_err(eth->dev, "
%s: invalid phy\n", __func__
);
return -EINVAL;
}