Date: Tue, 18 Mar 2014 16:46:24 +0400 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> Cc: net@FreeBSD.org Subject: Re: [PATCH 1/6] sfxge: fix mbuf leak if it does not fit in software queue Message-ID: <20140318124624.GD1499@FreeBSD.org> In-Reply-To: <53280DB3.4080900@oktetlabs.ru> References: <53280DB3.4080900@oktetlabs.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
--T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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.Rybchenko@oktetlabs.ru> A> Sponsored by: Solarflare Communications, Inc. Can we simplify the function while here? -- Totus tuus, Glebius. --T4sUOijqQbZv57TR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="1.diff" 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 --T4sUOijqQbZv57TR--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140318124624.GD1499>