HomeFreeBSD

cxgbe(4): Fix bad races between sysctl and driver detach.

Description

cxgbe(4): Fix bad races between sysctl and driver detach.

The default sysctl context setup by newbus for a device is eventually
freed by device_sysctl_fini, which runs after the device driver's detach
routine. sysctl nodes associated with this context must not use any
resources (like driver locks, hardware access, counters, etc.) that are
released by driver detach.

There are a lot of sysctl nodes like this in cxgbe(4) and the fix is to
hang them off a context that is explicitly freed by the driver before it
releases any resource that might be used by a sysctl.

This fixes panics when running "sysctl dev.t6nex dev.cc" in a tight loop
and loading/unloading the driver in parallel.

Reported by: Suhas Lokesha
MFC after: 1 week
Sponsored by: Chelsio Communications

Details

Provenance
npAuthored on Jan 13 2022, 10:21 PM
Parents
rG301b2b02dfcf: snd_hda: restore pin patch for headphones on Lenovo X1 7th Gen
Branches
Unknown
Tags
Unknown