HomeFreeBSD

iflib: Fix mbufs leaked by 0 len packets emitted from the if driver

Description

iflib: Fix mbufs leaked by 0 len packets emitted from the if driver

Some interface drivers, notably bnxt, can insert 0 length packets onto
their receive queues when certain conditions are met, such as discarding
packets in the case of bnxt.

When this packet gets processed by assemble_segments(), The solitary
mbuf on the queue that composes it consist of a single zero length
fragment. The loop in assemble_segments() doesn't seem to expect
that a 0 length fragment can exist in the iri_frags list without a
non-zero length header preceding it. In this situation, without filter
intervention rxd_frag_to_sd() returns a pointer to the corresponding
mbuf in the rxq, where it is matched as a zero-length fragment and
immediately discarded without freeing as mh has not yet been assigned.

This change corrects this behavior by falling through the mh == NULL
case and freeing m on the condition that it is not NULL before
continuing the loop.

Reviewed by: gallatin
Sponsored by: Spectra Logic
Differential Revision: https://reviews.freebsd.org/D57537

Details

Provenance
linnemannr_gmail.comAuthored on Jun 17 2026, 6:22 PM
kpCommitted on Jun 17 2026, 7:29 PM
Reviewer
gallatin
Differential Revision
D57537: iflib: Fix mbufs leaked by 0 len packets emitted from the if driver
Parents
rG17cf7760a98a: mlx5en: guard against empty eth_proto_oper mask
Branches
Unknown
Tags
Unknown