Page MenuHomeFreeBSD

iflib: cleanup queues when iflib_device_register fail
ClosedPublic

Authored by jacob.e.keller_intel.com on May 4 2018, 6:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 9, 8:39 PM
Unknown Object (File)
Sun, Sep 8, 12:42 PM
Unknown Object (File)
Sun, Sep 8, 12:19 PM
Unknown Object (File)
Sun, Sep 8, 9:36 AM
Unknown Object (File)
Fri, Sep 6, 12:36 AM
Unknown Object (File)
Thu, Aug 29, 12:01 AM
Unknown Object (File)
Tue, Aug 20, 7:53 PM
Unknown Object (File)
Aug 8 2024, 7:07 PM
Subscribers

Details

Summary

There is a memory leak of device driver queue resources that can occur
if iflib_device_register fails. This happens because we do not call
IFDI_QUEUES_FREE properly when cleaning up. This can be somewhat
confusing, as the memory leak checks will blame the malloc types related
to the device driver for this.

iflib_qset_structures_setup currently attempts to cleanup after itself
if iflib_rx_structures_setup fails, but not if iflib_tx_structures_setup
does.

Additionally, if any other function in iflib_device_register fails after
iflib_qset_structures_setup completes, we won't free the queues either.

Fix this by moving this cleanup code from within iflib_qset_structures_setup
directly into the fail_queues label of iflib_device_register.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

gallatin added inline comments.
sys/net/iflib.c
5069 ↗(On Diff #42150)

While we're cleaning this up, I'd either remove this print, or add a matching one for the tx setup, and remove the one in the caller. I realize that you can deduce which failed by how many prints you get, but that seems ... weird..

This revision is now accepted and ready to land.May 4 2018, 7:57 PM

While we're cleaning this up, I'd either remove this print, or add a matching one for the tx setup, and remove the one in the caller. I realize that you can deduce which failed by how many prints you get, but that seems ... weird..

Yea, I added the print in a separate review, I will also remove the print in the caller now too.

This revision was automatically updated to reflect the committed changes.