Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Dec 2017 19:50:06 +0000 (UTC)
From:      Stephen Hurd <shurd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326706 - head/sys/net
Message-ID:  <201712081950.vB8Jo67f090282@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: shurd
Date: Fri Dec  8 19:50:06 2017
New Revision: 326706
URL: https://svnweb.freebsd.org/changeset/base/326706

Log:
  Free mbuf chain when m_dup fails
  
  Fix memory leak where mbuf chain wasn't free()d if iflib_ether_pad()
  has a failure in m_dup().
  
  Reported by:	"Ryan Stone" <rysto32@gmail.com>
  Sponsored by:	Limelight Networks

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Fri Dec  8 19:26:25 2017	(r326705)
+++ head/sys/net/iflib.c	Fri Dec  8 19:50:06 2017	(r326706)
@@ -3125,6 +3125,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, ui
 	if (!M_WRITABLE(*m_head)) {
 		new_head = m_dup(*m_head, M_NOWAIT);
 		if (new_head == NULL) {
+			m_freem(*m_head);
 			device_printf(dev, "cannot pad short frame, m_dup() failed");
 			return ENOMEM;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712081950.vB8Jo67f090282>