git: 4c72b1c36dda - main - ng_pppoe: fix m_pullup() logic

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Mon, 19 Oct 2026 17:32:31 UTC
The branch main has been updated by glebius:

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

commit 4c72b1c36dda72b9ba8de593cac2c94e15f42bcf
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-10-19 17:30:43 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-10-19 17:30:43 +0000

    ng_pppoe: fix m_pullup() logic
    
    The clear intent here is to do m_pullup() if we _don't_ have two bytes.
    Before the fix: a) m_pullup() was always called and did nothing; b) if a
    node was ever supplied with a fragmented but otherwise correct mbuf, then
    it would not handle PROT_LCP as intended.
    
    Noticed by:             zlei
    Reviewed by:            zlei, eugen_grosbein.net
    Differential Revision:  https://reviews.freebsd.org/D60788
    Fixes:                  28903f396af4b151e16ea606cda66a9244fb179f
---
 sys/netgraph/ng_pppoe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 712efce31336..aaf1baf1e95e 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -1454,7 +1454,7 @@ ng_pppoe_rcvdata(hook_p hook, item_p item)
 		}
 
 		if (V_ng_pppoe_lcp_pcp && m->m_pkthdr.len >= 2 &&
-		    m->m_len >= 2 && (m = m_pullup(m, 2)) &&
+		    (m->m_len >= 2 || (m = m_pullup(m, 2))) &&
 		    mtod(m, uint16_t *)[0] == htons(PROT_LCP))
 			EVL_APPLY_PRI(m, (uint8_t)(V_ng_pppoe_lcp_pcp & 0x7));