Page MenuHomeFreeBSD

Fix leaks caused by ifc_nhwtxqs never being initialized
ClosedPublic

Authored by shurd on Nov 13 2018, 7:17 PM.

Details

Summary

r333502 removed initialization of ifc_nhwtxqs, and it's not clear
there's a need to copy it into the struct iflib_ctx at all. Use
ctx->ifc_sctx->isc_ntxqs instead.

Further, iflib_stop() did not clear the last ring in the case where
isc_nfl != isc_nrxqs (such as when IFLIB_HAS_RXCQ is set). Use
ctx->ifc_sctx->isc_nrxqs here instead of isc_nfl.

Reported by: pkelsey

Test Plan

Test with ixgbe, bnxt, and e1000 including use as a module.
Load/unload the module multiple times.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

shurd created this revision.Nov 13 2018, 7:17 PM
pkelsey accepted this revision.Nov 13 2018, 7:36 PM

Looks good to me.

Style-wise, would it be better to set up an sctx local at the top of these routines and then dereference that to avoid the double-dereference noise in the code?

This revision is now accepted and ready to land.Nov 13 2018, 7:36 PM
shurd updated this revision to Diff 50382.Nov 13 2018, 8:08 PM

Address feedback.

This revision now requires review to proceed.Nov 13 2018, 8:08 PM
shurd added a comment.Nov 13 2018, 8:09 PM

Style-wise, would it be better to set up an sctx local at the top of these routines and then dereference that to avoid the double-dereference noise in the code?

I'm not sure it's any better, but I don't mind doing it.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 14 2018, 3:17 PM
This revision was automatically updated to reflect the committed changes.