diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2017-07-19 12:25:35 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2017-07-19 12:25:35 +0000 |
commit | bb0e5b3ea7586cf6fe0ade25b1f3c5393d3c2266 (patch) | |
tree | 41676b280bd02a7fcef77f9a768d0131bf2f9f2f /sys | |
parent | 1b0c159808dfa19d683dc22e14f2506230ee502f (diff) |
Check if mbuf cluster allocation succeeded and on failure free mbuf and
return ENOBUFS.
Found by Ilja Van Sprundel
OK bluhm@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_et.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index b56bf1fc9ea..9abe09ad806 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.35 2017/01/22 10:17:38 dlg Exp $ */ +/* $OpenBSD: if_et.c,v 1.36 2017/07/19 12:25:34 claudio Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -1987,6 +1987,10 @@ et_newbuf(struct et_rxbuf_data *rbd, int buf_idx, int init, int len0) if (m == NULL) return (ENOBUFS); MCLGET(m, init ? M_WAITOK : M_DONTWAIT); + if ((m->m_flags & M_EXT) == 0) { + m_freem(m); + return (ENOBUFS); + } len = MCLBYTES; } else { MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA); |