summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/if_em.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2009-08-09 11:40:56 +0000
committerderaadt <deraadt@openbsd.org>2009-08-09 11:40:56 +0000
commit415ac77a3a2772736744faf2d84ece851590666b (patch)
tree059f756f4314ab891c239f074b6c70dd4668a948 /sys/dev/pci/if_em.c
parentInitialize all the InputFieldData members correctly. Fixes a crash when (diff)
downloadwireguard-openbsd-415ac77a3a2772736744faf2d84ece851590666b.tar.xz
wireguard-openbsd-415ac77a3a2772736744faf2d84ece851590666b.zip
MCLGETI() will now allocate a mbuf header if it is not provided, thus
reducing the amount of splnet/splx dancing required.. especially in the worst case (of m_cldrop) ok dlg kettenis damien
Diffstat (limited to 'sys/dev/pci/if_em.c')
-rw-r--r--sys/dev/pci/if_em.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index 7dbec34a729..9a7155f2ab6 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.215 2009/07/27 16:37:52 claudio Exp $ */
+/* $OpenBSD: if_em.c,v 1.216 2009/08/09 11:40:56 deraadt Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -2307,14 +2307,8 @@ em_get_buf(struct em_softc *sc, int i)
return (ENOBUFS);
}
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == NULL) {
- sc->mbuf_alloc_failed++;
- return (ENOBUFS);
- }
- MCLGETI(m, M_DONTWAIT, &sc->interface_data.ac_if, MCLBYTES);
- if ((m->m_flags & M_EXT) == 0) {
- m_freem(m);
+ m = MCLGETI(NULL, M_DONTWAIT, &sc->interface_data.ac_if, MCLBYTES);
+ if (!m) {
sc->mbuf_cluster_failed++;
return (ENOBUFS);
}