Module Name:    src
Committed By:   martin
Date:           Fri Mar 30 11:57:13 UTC 2018

Modified Files:
        src/sys/netinet6 [netbsd-8]: ip6_forward.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #671):

        sys/netinet6/ip6_forward.c: revision 1.91

Fix two pretty bad mistakes. If ipsec6_check_policy fails m is not freed,
and a 'goto out' is missing after ipsec6_process_packet.


To generate a diff of this commit:
cvs rdiff -u -r1.87.2.2 -r1.87.2.3 src/sys/netinet6/ip6_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ip6_forward.c
diff -u src/sys/netinet6/ip6_forward.c:1.87.2.2 src/sys/netinet6/ip6_forward.c:1.87.2.3
--- src/sys/netinet6/ip6_forward.c:1.87.2.2	Tue Jan  9 19:30:45 2018
+++ src/sys/netinet6/ip6_forward.c	Fri Mar 30 11:57:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_forward.c,v 1.87.2.2 2018/01/09 19:30:45 snj Exp $	*/
+/*	$NetBSD: ip6_forward.c,v 1.87.2.3 2018/03/30 11:57:13 martin Exp $	*/
 /*	$KAME: ip6_forward.c,v 1.109 2002/09/11 08:10:17 sakane Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.87.2.2 2018/01/09 19:30:45 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.87.2.3 2018/03/30 11:57:13 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -197,6 +197,7 @@ ip6_forward(struct mbuf *m, int srcrt)
 			 */
 			if (error == -EINVAL)
 				error = 0;
+			m_freem(m);
 			goto freecopy;
 		}
 	}
@@ -268,8 +269,10 @@ ip6_forward(struct mbuf *m, int srcrt)
 		int s = splsoftnet();
 		error = ipsec6_process_packet(m, sp->req);
 		splx(s);
+		/* m is freed */
 		if (mcopy)
 			goto freecopy;
+		goto out;
 	}
 #endif   
 

Reply via email to