]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
- In _iflib_fl_refill(), don't mark an RX buffer as available in the
authorMarius Strobl <marius@FreeBSD.org>
Sat, 26 Jan 2019 21:35:51 +0000 (21:35 +0000)
committerMarius Strobl <marius@FreeBSD.org>
Sat, 26 Jan 2019 21:35:51 +0000 (21:35 +0000)
commit3db348b54a93de22271e7c83f11e24abe228f6ba
tree557ae4fe2744c3e9cf7e8a10bd23c4c258e970dd
parent4268f3b3e0d87bc090b7fe0f95fb52a2e904db25
- In _iflib_fl_refill(), don't mark an RX buffer as available in the
  corresponding bitmap before adding an mbuf has actually succeeded.
  Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the
  RX ring but not in its bitmap. One implication of such a hole was
  that in a subsequent call to _iflib_fl_refill() with the RX buffer
  accounting still indicating another reclaimable buffer, bit_ffc(3)
  nevertheless returned -1 in frag_idx which in turn caused havoc
  when used as an index. Thus, additionally assert that frag_idx is
  0 or greater.
  Another possible consequence of a hole in the RX ring was a NULL-
  dereference when trying to use the unallocated mbuf, for example
  in iflib_rxd_pkt_get().

  While at it, make the variable declarations in _iflib_fl_refill()
  conform to style(9) and remove redundant checks already performed
  by bit_ffc{,_at}(3).

- In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3).

Reported and tested by: pho
sys/net/iflib.c