diff options
| author | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-08 04:14:53 +0000 |
|---|---|---|
| committer | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-14 21:49:21 +0000 |
| commit | fe00ca2f88718c7751b8953cc8ee7fc0dad0bbe1 (patch) | |
| tree | c8da5a9bb7727e7b23882b6e80258187a8ceff6a /sys/dev/netmap/netmap_null.c | |
| parent | 57293f4541cdea8e4158f751a4439f69b3ec1711 (diff) | |
iflib: Complete registration failure cleanup
Pre-attach sysctls contain pointers into the iflib context. Any later
registration failure that frees the context must first remove that
sysctl tree.
Failures after a successful IFDI_ATTACH_PRE also did not consistently
call IFDI_DETACH or free the private taskqueue. In particular, routing
a taskqueue creation failure through the context cleanup could free the
driver softc while resources allocated by attach_pre remained live.
Track successful interrupt and queue setup and use one common unwind
path. Invoke IFDI_DETACH with IFNET_WLOCK dropped and release only
resources whose setup completed. Leave a failed IFDI_ATTACH_PRE to
unwind its own partial state, as required by the existing driver
contract.
A failed post-attach can follow driver registration of an SR-IOV
schema. Remove that registration before detaching the interface and
driver, matching normal deregistration, so a failed attach cannot leave
a stale /dev/iov node or make the next attach report EBUSY.
A successful attach_pre can now be followed by detach before driver
queue allocation. Make the remaining queue-backed interrupt cleanup
paths tolerate absent queue arrays.
Mark a failed registration as detaching before draining the entire
private taskqueue. Drivers can register configuration tasks there, and
taskqueue_drain_all() does not wait for work queued during its drain.
Make every current non-admin callback reject detaching contexts so late
work cannot touch driver state.
Drain tasks and call ether_ifdetach() with neither the ifnet nor context
lock held. A callback already running may need either lock, while
ether_ifdetach() acquires ifnet_detach_sx. Reacquire IFNET_WLOCK before
the context lock to preserve the established lock order.
The shared automatic core-offset allocator also lacked acquisition
state. Late registration failures leaked its reference, while normal
detach could decrement a reference belonging to another device when a
configured offset or allocation failure meant that this context never
acquired one. Record acquisition explicitly and release only references
held.
MFC after: 2 weeks
Reviewed by: gallatin
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D58721
Diffstat (limited to 'sys/dev/netmap/netmap_null.c')
0 files changed, 0 insertions, 0 deletions
