]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
em: fix a null de-reference in em_free_pci_resources
authorMitchell Horne <mhorne@FreeBSD.org>
Wed, 2 Dec 2020 17:37:32 +0000 (17:37 +0000)
committerMitchell Horne <mhorne@FreeBSD.org>
Wed, 2 Dec 2020 17:37:32 +0000 (17:37 +0000)
commita3cd24398abcc7e407f9491e8eadda7d0ef85ebb
treecb8fba071860f8e781846e9fe9cd759a63040825
parentf4d6ed9a5c5f5e78b9e20ae0c4b3ab78922aaf20
em: fix a null de-reference in em_free_pci_resources

A failure in iflib_device_register() can result in
em_free_pci_resources() being called after receive queues have already
been freed. In particular, a failure to allocate IRQ resources will goto
fail_queues, where IFDI_QUEUES_FREE() will be called via
iflib_tx_structures_free(), preceding the call to IFDI_DETACH().

Cope with this by checking adapter->rx_queues before dereferencing it.
A similar check is present in ixgbe(4) and ixl(4).

MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27260
sys/dev/e1000/if_em.c