Page MenuHomeFreeBSD

if_geneve: Fix mbuf leak on ip_ecn_egress
ClosedPublic

Authored by pouria on Jul 20 2026, 8:46 PM.
Tags
None
Referenced Files
F168985246: D58361.id182306.diff
Mon, Aug 31, 1:36 AM
F168937415: D58361.id182312.diff
Sun, Aug 30, 8:36 PM
F168935791: D58361.id182311.diff
Sun, Aug 30, 8:25 PM
F168931317: D58361.id.diff
Sun, Aug 30, 7:51 PM
F168931024: D58361.diff
Sun, Aug 30, 7:48 PM
F168914488: D58361.id182310.diff
Sun, Aug 30, 5:46 PM
Unknown Object (File)
Sat, Aug 29, 7:10 PM
Unknown Object (File)
Thu, Aug 27, 9:28 AM

Details

Summary

Free mbuf and increase IFCOUNTER_IERRORS if ip_ecn_egress() under
geneve_input_inherit() decides to drop the packet.

Reported by: Chris Jarrett-Davies of the OpenAI Codex Security Team

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 74963
Build 71846: arc lint + arc unit

Event Timeline

sys/net/if_geneve.c
3134

The m_pullup() call above may free the old mbuf. In that case, since *m0 hasn't been updated, geneve_udp_input() will free the mbuf again in this error path.

IMO it is easiest to just

m_freem(m);
*m0 = NULL;
return (ENOBUFS);
sys/net/if_geneve.c
3128–3131

how about this one?

sys/net/if_geneve.c
3128–3131

That's fine too.

markj added inline comments.
sys/net/if_geneve.c
3187

Now you can remove this assignment.

This revision is now accepted and ready to land.Jul 20 2026, 9:17 PM
pouria marked 3 inline comments as done.

Address @markj comment, remove redundant *m0 = m assignment

This revision now requires review to proceed.Jul 20 2026, 9:21 PM
This revision is now accepted and ready to land.Jul 20 2026, 9:22 PM
This revision was automatically updated to reflect the committed changes.
sys/net/if_geneve.c
2844

BTW, there is a leak in this error path too, though I suspect this might not be triggerable in practice.