Page MenuHomeFreeBSD

Fix mbuf leaks in various pru_send implementations
ClosedPublic

Authored by markj on May 6 2021, 9:16 PM.

Details

Summary

The various protocol implementations are not very consistent about
freeing mbufs in error paths. In general, all protocols must free both
"m" and "control" upon an error, except if PRUS_NOTREADY is specified
(this is only implemented by TCP and unix(4) and requires further work
not handled in this diff), in which case "control" still must be freed.

This diff plugs various leaks in the pru_send implementations.

N.B. in general we seem to avoid calling m_freem(NULL), though this
works fine in practice and would be consistent with other kernel memory
allocators. Is there some reason to keep this pattern?

Diff Detail

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