summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_ether.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-06-19 17:58:50 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-06-19 17:58:50 +0000
commita0d4cb32dbf3ce6e2df43a7af22e64c7658d824f (patch)
treedb224d830e58d5c7024be3637ffc1772b8f69185 /sys/netinet/ip_ether.c
parent43476ea34bfa2f2287acc0bb5bf4aa9d305ecc03 (diff)
When dealing with mbuf pointers passed down as function parameters,
bugs could easily result in use-after-free or double free. Introduce m_freemp() which automatically resets the pointer before freeing it. So we have less dangling pointers in the kernel. OK krw@ mpi@ claudio@
Diffstat (limited to 'sys/netinet/ip_ether.c')
-rw-r--r--sys/netinet/ip_ether.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c
index 2fe409e08e7..c90b61441c0 100644
--- a/sys/netinet/ip_ether.c
+++ b/sys/netinet/ip_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.c,v 1.85 2017/04/14 20:46:31 bluhm Exp $ */
+/* $OpenBSD: ip_ether.c,v 1.86 2017/06/19 17:58:49 bluhm Exp $ */
/*
* The author of this code is Angelos D. Keromytis (kermit@adk.gr)
*
@@ -97,7 +97,7 @@ etherip_input(struct mbuf **mp, int *offp, int proto, int af)
if (!etherip_allow && ((*mp)->m_flags & (M_AUTH|M_CONF)) == 0) {
DPRINTF(("etherip_input(): dropped due to policy\n"));
etheripstat.etherips_pdrops++;
- m_freem(*mp);
+ m_freemp(mp);
return IPPROTO_DONE;
}
etherip_decap(*mp, *offp);
@@ -111,7 +111,7 @@ etherip_input(struct mbuf **mp, int *offp, int proto, int af)
default:
DPRINTF(("etherip_input(): dropped, unhandled protocol\n"));
etheripstat.etherips_pdrops++;
- m_freem(*mp);
+ m_freemp(mp);
return IPPROTO_DONE;
}
}