Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Fix two pretty bad mistakes. If ipsec6_check_po...



details:   https://anonhg.NetBSD.org/src/rev/fdd7f5816993
branches:  trunk
changeset: 829403:fdd7f5816993
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jan 29 08:14:54 2018 +0000

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

diffstat:

 sys/netinet6/ip6_forward.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r d391fd1b1b14 -r fdd7f5816993 sys/netinet6/ip6_forward.c
--- a/sys/netinet6/ip6_forward.c        Mon Jan 29 04:17:32 2018 +0000
+++ b/sys/netinet6/ip6_forward.c        Mon Jan 29 08:14:54 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_forward.c,v 1.90 2018/01/09 04:41:19 ozaki-r Exp $ */
+/*     $NetBSD: ip6_forward.c,v 1.91 2018/01/29 08:14:54 maxv 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.90 2018/01/09 04:41:19 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_forward.c,v 1.91 2018/01/29 08:14:54 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -197,6 +197,7 @@
                         */
                        if (error == -EINVAL)
                                error = 0;
+                       m_freem(m);
                        goto freecopy;
                }
        }
@@ -268,8 +269,10 @@
                int s = splsoftnet();
                error = ipsec6_process_packet(m, sp->req);
                splx(s);
+               /* m is freed */
                if (mcopy)
                        goto freecopy;
+               goto out;
        }
 #endif   
 



Home | Main Index | Thread Index | Old Index