summaryrefslogtreecommitdiff
path: root/sys/net/pf.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2011-01-19 11:39:58 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2011-01-19 11:39:58 +0000
commit94f9a32ab25c7ebdc4970ae976ae3d344c0bdba6 (patch)
tree796384e21f5822e59722d680c3ddcbf1fa34c216 /sys/net/pf.c
parent63c73df02c396211eab8a568f839f935d0cb2e56 (diff)
Give pf_normalize_ip() the same 3 way semantics as pf_test().
- PF_DROP, the packet is bad, the mbuf still exists and must be freed. - PF_PASS and *m0 is NULL, the packet has been processed, not an error. - PF_PASS and *m0 is not NULL, continue with packet processing. This fixes a potential mbuf use after free. ok henning@ markus@ mpf@
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r--sys/net/pf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 3010ecb2748..f9e1b8087ca 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.720 2011/01/11 13:35:58 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.721 2011/01/19 11:39:56 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -5852,6 +5852,8 @@ pf_test(int dir, struct ifnet *ifp, struct mbuf **m0,
goto done;
}
m = *m0; /* pf_normalize messes with m0 */
+ if (m == NULL)
+ return (PF_PASS);
h = mtod(m, struct ip *);
if (pf_setup_pdesc(AF_INET, dir, &pd, m, &action, &reason, kif, &a, &r,
@@ -6117,6 +6119,8 @@ pf_test6(int dir, struct ifnet *ifp, struct mbuf **m0,
goto done;
}
m = *m0; /* pf_normalize messes with m0 */
+ if (m == NULL)
+ return (PF_PASS);
h = mtod(m, struct ip6_hdr *);
#if 1