git: f7b71f832c99 - main - if_ovpn: Fix a lock leak in an error path

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sat, 20 Jun 2026 14:13:09 UTC
The branch main has been updated by markj:

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

commit f7b71f832c990da0bf203095f02405df665529d0
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-06-20 14:12:19 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-06-20 14:12:19 +0000

    if_ovpn: Fix a lock leak in an error path
    
    Reviewed by:    kp
    MFC after:      1 week
    Fixes:          04a7134c1e92 ("if_ovpn: fix use-after-free of mbuf")
    Differential Revision:  https://reviews.freebsd.org/D57696
---
 sys/net/if_ovpn.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c
index 7c416055e939..b4796fb95589 100644
--- a/sys/net/if_ovpn.c
+++ b/sys/net/if_ovpn.c
@@ -2517,6 +2517,7 @@ ovpn_udp_input(struct mbuf *m, int off, struct inpcb *inp,
 
 	m = m_unshare(m, M_NOWAIT);
 	if (m == NULL) {
+		OVPN_RUNLOCK(sc);
 		OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1);
 		if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1);
 		return (true);