Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Plug mbuf leak on MCLGET failure in sonic_rxintr.



details:   https://anonhg.NetBSD.org/src/rev/5e36877f8628
branches:  trunk
changeset: 825732:5e36877f8628
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 29 01:34:49 2017 +0000

description:
Plug mbuf leak on MCLGET failure in sonic_rxintr.

>From Ilja Van Sprundel.

diffstat:

 sys/dev/ic/dp83932.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r c2650d1dc2d9 -r 5e36877f8628 sys/dev/ic/dp83932.c
--- a/sys/dev/ic/dp83932.c      Sat Jul 29 01:31:20 2017 +0000
+++ b/sys/dev/ic/dp83932.c      Sat Jul 29 01:34:49 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dp83932.c,v 1.40 2017/05/23 02:19:14 ozaki-r Exp $     */
+/*     $NetBSD: dp83932.c,v 1.41 2017/07/29 01:34:49 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.40 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.41 2017/07/29 01:34:49 riastradh Exp $");
 
 
 #include <sys/param.h>
@@ -786,8 +786,10 @@
                                goto dropit;
                        if (len > (MHLEN - 2)) {
                                MCLGET(m, M_DONTWAIT);
-                               if ((m->m_flags & M_EXT) == 0)
+                               if ((m->m_flags & M_EXT) == 0) {
+                                       m_freem(m);
                                        goto dropit;
+                               }
                        }
                        m->m_data += 2;
                        /*



Home | Main Index | Thread Index | Old Index