linux/drivers/net/ethernet/ti
Sekhar Nori 30c57f0734 net: ethernet: ti: cpsw: fix race condition during open()
TI's cpsw driver handles both OF and non-OF case for phy
connect. Unfortunately of_phy_connect() returns NULL on
error while phy_connect() returns ERR_PTR().

To handle this, cpsw_slave_open() overrides the return value
from phy_connect() to make it NULL or error.

This leaves a small window, where cpsw_adjust_link() may be
invoked for a slave while slave->phy pointer is temporarily
set to -ENODEV (or some other error) before it is finally set
to NULL.

_cpsw_adjust_link() only handles the NULL case, and an oops
results when ERR_PTR() is seen by it.

Note that cpsw_adjust_link() checks PHY status for each
slave whenever it is invoked. It can so happen that even
though phy_connect() for a given slave returns error,
_cpsw_adjust_link() is still called for that slave because
the link status of another slave changed.

Fix this by using a temporary pointer to store return value
of {of_}phy_connect() and do a one-time write to slave->phy.

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Reported-by: Yan Liu <yan-liu@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-04-04 10:33:33 -07:00
..
cpmac.c cpmac: remove hopeless #warning 2017-01-16 11:54:36 -05:00
cpsw_ale.c net: netcp: ale: add proper ale entry mask bits for netcp switch ALE 2017-01-07 21:03:50 -05:00
cpsw_ale.h net: netcp: ale: add proper ale entry mask bits for netcp switch ALE 2017-01-07 21:03:50 -05:00
cpsw-common.c net: cpsw: Fix ethernet regression for dm814x 2015-11-20 10:46:33 -05:00
cpsw-phy-sel.c drivers: net: cpsw-phy-sel: Clear RGMII_IDMODE on "rgmii" links 2016-12-07 13:12:17 -05:00
cpsw.c net: ethernet: ti: cpsw: fix race condition during open() 2017-04-04 10:33:33 -07:00
cpsw.h net: ethernet: ti: cpts: move dt props parsing to cpts driver 2016-12-07 11:13:48 -05:00
cpts.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
cpts.h net: ethernet: ti: cpts: fix overflow check period 2016-12-07 11:13:48 -05:00
davinci_cpdma.c net: ethernet: ti: davinci_cpdma: correct check on NULL in set rate 2017-01-18 16:46:01 -05:00
davinci_cpdma.h net: ethernet: ti: cpsw: add support for ringparam configuration 2017-01-07 20:48:14 -05:00
davinci_emac.c drivers: net: generalize napi_complete_done() 2017-01-30 15:10:42 -05:00
davinci_mdio.c drivers: net: davinci_mdio: enable pm runtime auto for ti cpsw-mdio 2016-06-28 08:57:19 -04:00
Kconfig cpsw/netcp: cpts depends on posix_timers 2017-03-22 10:56:42 -07:00
Makefile cpsw/netcp: work around reverse cpts dependency 2017-03-22 10:56:42 -07:00
netcp_core.c net: ethernet: ti: netcp_core: remove netif_trans_update 2017-02-10 13:52:24 -05:00
netcp_ethss.c net: netcp: Do not clobber PHY link outside of state machine 2017-02-07 13:48:22 -05:00
netcp_sgmii.c net: netcp: Fixes SGMII reset on network interface shutdown 2015-07-27 01:14:26 -07:00
netcp_xgbepcsr.c
netcp.h net: netcp: use hw capability to remove FCS word from rx packets 2017-01-07 21:03:50 -05:00
tlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-10-14 10:00:27 -04:00
tlan.h