svn commit: r226219 - head/sys/dev/usb/serial

Hans Petter Selasky hselasky at FreeBSD.org
Mon Oct 10 15:54:45 UTC 2011


Author: hselasky
Date: Mon Oct 10 15:54:44 2011
New Revision: 226219
URL: http://svn.freebsd.org/changeset/base/226219

Log:
  Bugfix: The ucom detach function is sometimes called on zeroed structures.
  Check for this case and just return, so that the UCOM unit number zero is
  not accidentially freed.
  
  Submitted by:	Danish FreeBSD user at EuroBSDcon 2011
  MFC after:	3 days

Modified:
  head/sys/dev/usb/serial/usb_serial.c

Modified: head/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.c	Mon Oct 10 15:43:09 2011	(r226218)
+++ head/sys/dev/usb/serial/usb_serial.c	Mon Oct 10 15:54:44 2011	(r226219)
@@ -289,6 +289,9 @@ ucom_detach(struct ucom_super_softc *ssc
 {
 	uint32_t subunit;
 
+	if (ssc->sc_subunits == 0)
+		return;		/* not initialized */
+
 	usb_proc_drain(&ssc->sc_tq);
 
 	for (subunit = 0; subunit < ssc->sc_subunits; subunit++) {


More information about the svn-src-head mailing list