From owner-svn-src-head@freebsd.org Tue Nov 3 21:11:31 2015 Return-Path: Delivered-To: svn-src-head@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 C3B9AA25DE5; Tue, 3 Nov 2015 21:11:31 +0000 (UTC) (envelope-from adrian@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 92B2113C9; Tue, 3 Nov 2015 21:11:31 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tA3LBUQU079383; Tue, 3 Nov 2015 21:11:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA3LBUpB079382; Tue, 3 Nov 2015 21:11:30 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201511032111.tA3LBUpB079382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 3 Nov 2015 21:11:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290339 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2015 21:11:31 -0000 Author: adrian Date: Tue Nov 3 21:11:30 2015 New Revision: 290339 URL: https://svnweb.freebsd.org/changeset/base/290339 Log: ath(4) - don't try to free buffers / return an error if we've committed to transmit the buffer. ath_tx_start() may manipulate/reallocate the mbuf as part of the DMA code, so we can't expect the mbuf can be returned back to the caller. Now, the net80211 ifnet work changed the semantics slightly so if an error is returned here, the mbuf/reference is freed by the caller (here, it's net80211.) So, once we reach ath_tx_start(), we never return failure. If we fail then we still return OK and we free the mbuf/noderef ourselves, and we increment OERRORS. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Nov 3 21:03:26 2015 (r290338) +++ head/sys/dev/ath/if_ath.c Tue Nov 3 21:11:30 2015 (r290339) @@ -3320,6 +3320,9 @@ nextfrag: * * Note: if this fails, then the mbufs are freed but * not the node reference. + * + * So, we now have to free the node reference ourselves here + * and return OK up to the stack. */ next = m->m_nextpkt; if (ath_tx_start(sc, ni, bf, m)) { @@ -3336,7 +3339,14 @@ reclaim: */ ath_txfrag_cleanup(sc, &frags, ni); ATH_TXBUF_UNLOCK(sc); - retval = ENOBUFS; + + /* + * XXX: And free the node/return OK; ath_tx_start() may have + * modified the buffer. We currently have no way to + * signify that the mbuf was freed but there was an error. + */ + ieee80211_free_node(ni); + retval = 0; goto finish; }