Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/ipf/netinet Fix 2 bugs, reported by Edgar F...



details:   https://anonhg.NetBSD.org/src/rev/4a339fb6f459
branches:  trunk
changeset: 459891:4a339fb6f459
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Sep 30 16:58:06 2019 +0000

description:
Fix 2 bugs, reported by Edgar Fu? on tech-net@
- pfil_run_hooks() can be called recursively, so we have to
  #define FASTROUTE_RECURSION in fil.c
- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
  to set *mpp to NULL so the caller won't try to free it again.

diffstat:

 sys/external/bsd/ipf/netinet/fil.c           |  6 ++++--
 sys/external/bsd/ipf/netinet/ip_fil_netbsd.c |  6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 7c6372c70041 -r 4a339fb6f459 sys/external/bsd/ipf/netinet/fil.c
--- a/sys/external/bsd/ipf/netinet/fil.c        Mon Sep 30 13:44:52 2019 +0000
+++ b/sys/external/bsd/ipf/netinet/fil.c        Mon Sep 30 16:58:06 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fil.c,v 1.30 2019/08/08 14:38:53 christos Exp $        */
+/*     $NetBSD: fil.c,v 1.31 2019/09/30 16:58:06 bouyer Exp $  */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -141,7 +141,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.30 2019/08/08 14:38:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.31 2019/09/30 16:58:06 bouyer Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c        1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -155,6 +155,8 @@
 extern int     blockreason;
 #endif /* _KERNEL */
 
+#define FASTROUTE_RECURSION
+
 #define        LBUMP(x)        softc->x++
 #define        LBUMPD(x, y)    do { softc->x.y++; DT(y); } while (0)
 
diff -r 7c6372c70041 -r 4a339fb6f459 sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
--- a/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c      Mon Sep 30 13:44:52 2019 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c      Mon Sep 30 16:58:06 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_fil_netbsd.c,v 1.31 2018/08/10 07:16:13 maxv Exp $  */
+/*     $NetBSD: ip_fil_netbsd.c,v 1.32 2019/09/30 16:58:06 bouyer Exp $        */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.31 2018/08/10 07:16:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.32 2019/09/30 16:58:06 bouyer Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c     2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -1493,6 +1493,8 @@
 # else
                        error = nd6_output(ifp, ifp, m0, dst6, rt);
 # endif
+                       if (error)
+                               *mpp = NULL; /* m0 has been  freed */
                } else {
                        error = EMSGSIZE;
                }



Home | Main Index | Thread Index | Old Index