Module Name: src
Committed By: bouyer
Date: Mon Sep 30 16:58:07 UTC 2019
Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c ip_fil_netbsd.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.31 -r1.32 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.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/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.30 src/sys/external/bsd/ipf/netinet/fil.c:1.31
--- src/sys/external/bsd/ipf/netinet/fil.c:1.30 Thu Aug 8 14:38:53 2019
+++ src/sys/external/bsd/ipf/netinet/fil.c Mon Sep 30 16:58:06 2019
@@ -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 @@ extern struct timeout ipf_slowtimer_ch;
#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 opts;
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)
Index: src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.31 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.32
--- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.31 Fri Aug 10 07:16:13 2018
+++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c Mon Sep 30 16:58:06 2019
@@ -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 @@ ipf_fastroute6(struct mbuf *m0, struct m
# else
error = nd6_output(ifp, ifp, m0, dst6, rt);
# endif
+ if (error)
+ *mpp = NULL; /* m0 has been freed */
} else {
error = EMSGSIZE;
}