Source-Changes-HG archive

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

[src/trunk]: src/sys/net80211 Fix memory leak. If m1 == m, m = NULL, so it's ...



details:   https://anonhg.NetBSD.org/src/rev/98f536de66ab
branches:  trunk
changeset: 829082:98f536de66ab
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jan 16 14:01:13 2018 +0000

description:
Fix memory leak. If m1 == m, m = NULL, so it's safe to just call m_freem.

diffstat:

 sys/net80211/ieee80211_input.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r 165276626c3f -r 98f536de66ab sys/net80211/ieee80211_input.c
--- a/sys/net80211/ieee80211_input.c    Tue Jan 16 13:48:21 2018 +0000
+++ b/sys/net80211/ieee80211_input.c    Tue Jan 16 14:01:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $        */
+/*     $NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $        */
 
 /*
  * Copyright (c) 2001 Atsushi Onoe
@@ -37,7 +37,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.94 2018/01/16 09:42:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.95 2018/01/16 14:01:13 maxv Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
@@ -891,6 +891,7 @@
                                ieee80211_free_node(sta);
                        }
                }
+
                if (m1 != NULL) {
                        int len;
 #ifdef ALTQ
@@ -902,13 +903,14 @@
                        IFQ_ENQUEUE(&ifp->if_snd, m1, error);
                        if (error) {
                                ifp->if_oerrors++;
+                               m_freem(m);
                                m = NULL;
                        }
                        ifp->if_obytes += len;
                }
        }
+
        if (m != NULL) {
-
                if (ni->ni_vlan != 0)
                        vlan_set_tag(m, ni->ni_vlan);
 
@@ -919,6 +921,7 @@
                KASSERT(ifp->if_percpuq);
                if_percpuq_enqueue(ifp->if_percpuq, m);
        }
+
        return;
 }
 



Home | Main Index | Thread Index | Old Index