diff options
author | Kristof Provost <kp@FreeBSD.org> | 2022-08-10 13:57:05 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2022-08-19 21:09:11 +0000 |
commit | 7647626d3380d17096b2690eb25f9d8fa18d0f83 (patch) | |
tree | a6fb250f54c8d38c0cde04f31f8b7d00f83ddace | |
parent | 820bafd0bc14a1448d7e5314e6c9f026518a66de (diff) | |
download | src-7647626d3380d17096b2690eb25f9d8fa18d0f83.tar.gz src-7647626d3380d17096b2690eb25f9d8fa18d0f83.zip |
e6000sw: fix incorrect locking
During attach we release the lock to call e6000sw_attach_miibus(), which
calls mii_attach(). The mii_attach() function calls miibus_readreg() /
miibus_writereg(). However, these are set to be
e6000sw_readphy_locked().
That is, the read/write phy functions do not acquire the lock, but
expect to be called while locked. Simply do not unlock and relock while
calling mii_attach().
Reviewed by: Hubert Mazur <hum@semihalf.com>
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36117
-rw-r--r-- | sys/dev/etherswitch/e6000sw/e6000sw.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c index d096c31b349a..f3d46ff2f926 100644 --- a/sys/dev/etherswitch/e6000sw/e6000sw.c +++ b/sys/dev/etherswitch/e6000sw/e6000sw.c @@ -529,20 +529,11 @@ e6000sw_attach(device_t dev) if (!e6000sw_is_phyport(sc, port)) continue; - /* - * It's necessary to unlock mutex, because e6000sw_attach_miibus - * calls functions, which try to lock mutex.That leads - * to recursive lock on non recursive mutex. - */ - E6000SW_UNLOCK(sc); - err = e6000sw_attach_miibus(sc, port); if (err != 0) { device_printf(sc->dev, "failed to attach miibus\n"); goto out_fail; } - - E6000SW_LOCK(sc); } etherswitch_info.es_nports = sc->num_ports; |