Andrew, On Tue, Mar 18, 2014 at 01:11:15PM +0400, Andrew Rybchenko wrote: A> A> sfxge: fix mbuf leak if it does not fit in software queue A> A> mbuf should be owned by if_transmit function in any case. A> A> Submitted-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> A> Sponsored by: Solarflare Communications, Inc.
Can we simplify the function while here? -- Totus tuus, Glebius.
Index: sfxge_tx.c =================================================================== --- sfxge_tx.c (revision 263296) +++ sfxge_tx.c (working copy) @@ -498,7 +498,6 @@ int sfxge_tx_packet_add(struct sfxge_txq *txq, struct mbuf *m) { int locked; - int rc; /* * Try to grab the txq lock. If we are able to get the lock, @@ -511,10 +510,9 @@ sfxge_tx_packet_add(struct sfxge_txq *txq, struct * Can only fail if we weren't able to get the lock. */ if (sfxge_tx_qdpl_put(txq, m, locked) != 0) { - KASSERT(!locked, - ("sfxge_tx_qdpl_put() failed locked")); - rc = ENOBUFS; - goto fail; + KASSERT(!locked, ("sfxge_tx_qdpl_put() failed locked")); + m_freem(m); + return (ENOBUFS); } /* @@ -534,10 +532,6 @@ sfxge_tx_packet_add(struct sfxge_txq *txq, struct } return (0); - -fail: - return (rc); - } static void
_______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"