Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Check for MCLGET failure in dme_alloc_receive_buf...



details:   https://anonhg.NetBSD.org/src/rev/4d404c4c851a
branches:  trunk
changeset: 355430:4d404c4c851a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 29 01:31:20 2017 +0000

description:
Check for MCLGET failure in dme_alloc_receive_buffer.

>From Ilja Van Sprundel.

diffstat:

 sys/dev/ic/dm9000.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r dc2bbcda6332 -r 4d404c4c851a sys/dev/ic/dm9000.c
--- a/sys/dev/ic/dm9000.c       Sat Jul 29 01:19:29 2017 +0000
+++ b/sys/dev/ic/dm9000.c       Sat Jul 29 01:31:20 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dm9000.c,v 1.11 2016/12/15 09:28:05 ozaki-r Exp $      */
+/*     $NetBSD: dm9000.c,v 1.12 2017/07/29 01:31:20 riastradh Exp $    */
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -1226,8 +1226,13 @@
                sizeof(struct ether_header);
        /* All our frames have the CRC attached */
        m->m_flags |= M_HASFCS;
-       if (m->m_pkthdr.len + pad > MHLEN )
+       if (m->m_pkthdr.len + pad > MHLEN) {
                MCLGET(m, M_DONTWAIT);
+               if ((m->m_flags & M_EXT) == 0) {
+                       m_freem(m);
+                       return NULL;
+               }
+       }
 
        m->m_data += pad;
        m->m_len = frame_length + (frame_length % sc->sc_data_width);



Home | Main Index | Thread Index | Old Index