diff options
author | 2014-09-19 02:52:55 +0000 | |
---|---|---|
committer | 2014-09-19 02:52:55 +0000 | |
commit | 31cc01cb7d4c05809a9c7aee66191f375e77b153 (patch) | |
tree | 04eb47ac1c168b509abbb4be05f1c47dfdd5ef2c | |
parent | add missing HISTORY sections; (diff) | |
download | wireguard-openbsd-31cc01cb7d4c05809a9c7aee66191f375e77b153.tar.xz wireguard-openbsd-31cc01cb7d4c05809a9c7aee66191f375e77b153.zip |
passing M_NOWAIT to m_tag_get means it can fail, which could hit
the failure path which leaks all the stuff the previous code in
bpf_movein allocates.
since it's only called from bpfwrite, use M_WAIT instead to make
it reliable and just get rid of the bogus failure code.
ok miod@
-rw-r--r-- | sys/net/bpf.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index e3a7f96fdc3..ff4cb1088fe 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.c,v 1.103 2014/07/12 18:44:22 tedu Exp $ */ +/* $OpenBSD: bpf.c,v 1.104 2014/09/19 02:52:55 dlg Exp $ */ /* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */ /* @@ -224,9 +224,7 @@ bpf_movein(struct uio *uio, u_int linktype, struct mbuf **mp, /* * Prepend the data link type as a mbuf tag */ - mtag = m_tag_get(PACKET_TAG_DLT, sizeof(u_int), M_NOWAIT); - if (mtag == NULL) - return (ENOMEM); + mtag = m_tag_get(PACKET_TAG_DLT, sizeof(u_int), M_WAIT); *(u_int *)(mtag + 1) = linktype; m_tag_prepend(m, mtag); |