Summary: | broken locking in e6000sw | ||
---|---|---|---|
Product: | Base System | Reporter: | Mark Johnston <markj> |
Component: | kern | Assignee: | Mark Johnston <markj> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | emaste, mw |
Priority: | --- | ||
Version: | 15.0-CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Mark Johnston
2023-10-29 17:26:22 UTC
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=725962a9f4c050b21488edd58d317e87c76d6f66 commit 725962a9f4c050b21488edd58d317e87c76d6f66 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-11-06 19:57:56 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-11-06 19:57:56 +0000 e6000sw: Fix locking in miibus_{read,write}reg implementations Commit 469290648005e13b819a19353032ca53dda4378f made e6000sw's implementation of miibus_(read|write)reg assume that the softc lock is held. I presume that is to avoid lock recursion in e6000sw_attach() -> e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG(). However, the lock assertion in e6000sw_readphy_locked() can fail if a different driver uses the interface to probe registers. Work around the problem by providing implementations which lock the softc if it is not already locked. PR: 274795 Fixes: 469290648005 ("e6000sw: add readphy and writephy wrappers") Reviewed by: kp, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42466 sys/dev/etherswitch/e6000sw/e6000sw.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=766cceba19fe05095d81994e930a489ad545d42b commit 766cceba19fe05095d81994e930a489ad545d42b Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-11-06 19:57:56 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-11-13 14:41:50 +0000 e6000sw: Fix locking in miibus_{read,write}reg implementations Commit 469290648005e13b819a19353032ca53dda4378f made e6000sw's implementation of miibus_(read|write)reg assume that the softc lock is held. I presume that is to avoid lock recursion in e6000sw_attach() -> e6000sw_attach_miibus() -> mii_attach() -> MIIBUS_READREG(). However, the lock assertion in e6000sw_readphy_locked() can fail if a different driver uses the interface to probe registers. Work around the problem by providing implementations which lock the softc if it is not already locked. PR: 274795 Fixes: 469290648005 ("e6000sw: add readphy and writephy wrappers") Reviewed by: kp, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42466 (cherry picked from commit 725962a9f4c050b21488edd58d317e87c76d6f66) sys/dev/etherswitch/e6000sw/e6000sw.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) |