From owner-svn-src-all@freebsd.org Thu Nov 5 22:44:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E79B9A26DC8; Thu, 5 Nov 2015 22:44:37 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE7E1D54; Thu, 5 Nov 2015 22:44:37 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tA5MiaZZ059972; Thu, 5 Nov 2015 22:44:36 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA5Miaq2059971; Thu, 5 Nov 2015 22:44:36 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201511052244.tA5Miaq2059971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Thu, 5 Nov 2015 22:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290427 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2015 22:44:38 -0000 Author: avos Date: Thu Nov 5 22:44:36 2015 New Revision: 290427 URL: https://svnweb.freebsd.org/changeset/base/290427 Log: iwn(4): various simple fixes - Fix mbuf leaks in iwn_raw_xmit() and iwn_xmit_task() (regression since r288178). - Check IWN_FLAG_RUNNING flag under lock. - Remove m->m_pkthdr.rcvif initialization (fixed in r283994). - Enclose some values in return statements into parentheses. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4069 Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Thu Nov 5 22:42:40 2015 (r290426) +++ head/sys/dev/iwn/if_iwn.c Thu Nov 5 22:44:36 2015 (r290427) @@ -4852,6 +4852,7 @@ iwn_xmit_task(void *arg0, int pending) if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1); ieee80211_free_node(ni); + m_freem(m); } } @@ -4872,16 +4873,13 @@ iwn_raw_xmit(struct ieee80211_node *ni, DPRINTF(sc, IWN_DEBUG_XMIT | IWN_DEBUG_TRACE, "->%s begin\n", __func__); + IWN_LOCK(sc); if ((sc->sc_flags & IWN_FLAG_RUNNING) == 0) { m_freem(m); - return ENETDOWN; + IWN_UNLOCK(sc); + return (ENETDOWN); } - /* XXX? net80211 doesn't set this on xmit'ed raw frames? */ - m->m_pkthdr.rcvif = (void *) ni; - - IWN_LOCK(sc); - /* queue frame if we have to */ if (sc->sc_beacon_wait) { if (iwn_xmit_queue_enqueue(sc, m) != 0) { @@ -4909,12 +4907,14 @@ iwn_raw_xmit(struct ieee80211_node *ni, } if (error == 0) sc->sc_tx_timer = 5; + else + m_freem(m); IWN_UNLOCK(sc); DPRINTF(sc, IWN_DEBUG_TRACE | IWN_DEBUG_XMIT, "->%s: end\n",__func__); - return error; + return (error); } /*