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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to