git: if_tun: Fix mbuf chain leak in tunwrite()

Aaron LI aly at crater.dragonflybsd.org
Tue Jul 21 04:44:06 PDT 2026


commit a0bf7401f7ffd106918e33ff01ddff02a66983e9
Author: Nathan Sapwell <nathan at dreamfast.solutions>
Date:   Thu Jul 2 09:43:02 2026 +0000

    if_tun: Fix mbuf chain leak in tunwrite()
    
    tunwrite() builds an mbuf chain headed by 'top' in its read loop;
    on the final iteration the local 'm' points at the chain tail.
    Then the subsequent EAFNOSUPPORT default case of the family switch calls
    m_freem(m), freeing only that tail mbuf and leaking the chain head and
    all intermediates.
    
    Fix the m_freem() to free from 'top' instead to free the whole mbuf
    chain, matching the earlier error path.
    
    While there, fix one indentation. (aly)
    
    GitHub-PR: #39
    Assisted-with: Zhipu GLM-5.2

Summary of changes:
 sys/net/tun/if_tun.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a0bf7401f7ffd106918e33ff01ddff02a66983e9


-- 
DragonFly BSD source repository


More information about the Commits mailing list