git: d8354b5bb56e - stable/15 - iflib: fix iflib_simple_transmit() when interface is down

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 06:03:00 UTC
The branch stable/15 has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=d8354b5bb56e7cc6c48391bf638ca7647a1ce8ea

commit d8354b5bb56e7cc6c48391bf638ca7647a1ce8ea
Author:     Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2025-11-20 00:48:56 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 05:28:16 +0000

    iflib: fix iflib_simple_transmit() when interface is down
    
    Use the same check as iflib_if_transmit() to detect when the
    interface is down and return the proper error code, and also
    free the mbuf.
    
    This fixes an mbuf leak when a member of a lagg is brought
    down (and probably many other scenarios).
    
    Sponsored by: Netflix
    
    (cherry picked from commit 896dc30bc9bc2f7407b04ca4c08f88b1c7bf9d60)
---
 sys/net/iflib.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 79a623db4e57..8f0b0a13bc6e 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -7571,9 +7571,13 @@ iflib_simple_transmit(if_t ifp, struct mbuf *m)
 
 
 	ctx = if_getsoftc(ifp);
-	if ((if_getdrvflags(ifp) & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
-	    IFF_DRV_RUNNING)
-		return (EBUSY);
+	if (__predict_false((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0
+		|| !LINK_ACTIVE(ctx))) {
+		DBG_COUNTER_INC(tx_frees);
+		m_freem(m);
+		return (ENETDOWN);
+	}
+
 	txq = iflib_simple_select_queue(ctx, m);
 	mtx_lock(&txq->ift_mtx);
 	error = iflib_encap(txq, &m);