Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2012 16:23:01 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241034 - head/sys/dev/usb/net
Message-ID:  <201209281623.q8SGN1dN070424@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Sep 28 16:23:01 2012
New Revision: 241034
URL: http://svn.freebsd.org/changeset/base/241034

Log:
  Make sure we don't leak a mbuf in a fail case.

Modified:
  head/sys/dev/usb/net/if_smsc.c

Modified: head/sys/dev/usb/net/if_smsc.c
==============================================================================
--- head/sys/dev/usb/net/if_smsc.c	Fri Sep 28 15:33:13 2012	(r241033)
+++ head/sys/dev/usb/net/if_smsc.c	Fri Sep 28 16:23:01 2012	(r241034)
@@ -1043,8 +1043,11 @@ smsc_bulk_read_callback(struct usb_xfer 
 			
 				/* Finally enqueue the mbuf on the receive queue */
 				/* Remove 4 trailing bytes */
-				if (pktlen >= (4 + ETHER_HDR_LEN))
-					uether_rxmbuf(ue, m, pktlen - 4);
+				if (pktlen < (4 + ETHER_HDR_LEN)) {
+					m_freem(m);
+					goto tr_setup;
+				}
+				uether_rxmbuf(ue, m, pktlen - 4);
 			}
 
 			/* Update the offset to move to the next potential packet */



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