]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
iflib: Free resources in a consistent order during detach
authorSai Rajesh Tallamraju <stallamr@netapp.com>
Mon, 1 Feb 2021 16:13:00 +0000 (11:13 -0500)
committerKevin Bowling <kbowling@FreeBSD.org>
Tue, 28 Sep 2021 17:21:52 +0000 (10:21 -0700)
commit5b4cfd3f1315856029256a9847d78d3b1b717fb0
tree973710535e2456b1640adac06a03cecfdb15e348
parenta02f614070a862b98dcb7c09fec7cfa9a701eefe
iflib: Free resources in a consistent order during detach

Memory and PCI resources are freed with no particular order.  This could
cause use-after-frees when detaching following a failed attach.  For
instance, iflib_tx_structures_free() frees ctx->ifc_txqs[] but
iflib_tqg_detach() attempts to access this array. Similarly, adapter
queues gets freed by IFDI_QUEUES_FREE() but IFDI_DETACH() attempts to
access adapter queues to free PCI resources.

MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D27634

(cherry picked from commit 38bfc6dee33bedb290e1ea2540f97a86fe3caee0)
sys/dev/e1000/if_em.c
sys/dev/ixl/if_ixl.c
sys/net/iflib.c