Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Check for MCLGET failure in et_newbuf.



details:   https://anonhg.NetBSD.org/src/rev/6b8f175d6f88
branches:  trunk
changeset: 825734:6b8f175d6f88
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 29 01:47:48 2017 +0000

description:
Check for MCLGET failure in et_newbuf.

>From Ilja Van Sprundel.

diffstat:

 sys/dev/pci/if_et.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 8309d3899d2d -r 6b8f175d6f88 sys/dev/pci/if_et.c
--- a/sys/dev/pci/if_et.c       Sat Jul 29 01:45:22 2017 +0000
+++ b/sys/dev/pci/if_et.c       Sat Jul 29 01:47:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_et.c,v 1.14 2016/12/15 09:28:05 ozaki-r Exp $       */
+/*     $NetBSD: if_et.c,v 1.15 2017/07/29 01:47:48 riastradh Exp $     */
 /*     $OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $  */
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.15 2017/07/29 01:47:48 riastradh Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -2026,6 +2026,10 @@
                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);



Home | Main Index | Thread Index | Old Index