Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Oct 2023 17:26:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 274795] broken locking in e6000sw
Message-ID:  <bug-274795-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274795

            Bug ID: 274795
           Summary: broken locking in e6000sw
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: markj@FreeBSD.org
                CC: mw@FreeBSD.org

Commit 469290648005e13b819a19353032ca53dda4378f made e6000sw's implementati=
on
of miibus_(read|write)reg assume that the softc lock is held.  I presume th=
at
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:

panic: Lock e6000sw not exclusively locked @
/usr/home/markj/src/freebsd/sys/dev/etherswitch/e6000sw/e6000sw.c:773

cpuid =3D 0
time =3D 1698599456
KDB: stack backtrace:
db_trace_self() at db_trace_self
db_trace_self_wrapper() at db_trace_self_wrapper+0x38
vpanic() at vpanic+0x1a0
panic() at panic+0x48
_sx_assert() at _sx_assert+0x100
e6000sw_readphy_locked() at e6000sw_readphy_locked+0x40
gentbi_probe() at gentbi_probe+0x7c
device_probe_child() at device_probe_child+0x150=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
device_probe() at device_probe+0xa0=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20
device_probe_and_attach() at device_probe_and_attach+0x38=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bus_generic_attach() at bus_generic_attach+0x1c=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
miibus_attach() at miibus_attach+0x88=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20
device_attach() at device_attach+0x3fc
device_probe_and_attach() at device_probe_and_attach+0x80=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bus_generic_driver_added() at bus_generic_driver_added+0x90
devclass_driver_added() at devclass_driver_added+0x48
devclass_add_driver() at devclass_add_driver+0x148
module_register_init() at module_register_init+0xb4=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
linker_load_module() at linker_load_module+0xacc=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
kern_kldload() at kern_kldload+0x190=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20
sys_kldload() at sys_kldload+0x64=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20
do_el0_sync() at do_el0_sync+0x59c=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20
handle_el0_sync() at handle_el0_sync+0x48

In particular, gentbi_probe() obviously didn't acquire the softc lock.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-274795-227>