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

Nick Hibma n_hibma at FreeBSD.org
Sun Nov 7 15:36:07 UTC 2010


Author: n_hibma
Date: Sun Nov  7 15:36:07 2010
New Revision: 214919
URL: http://svn.freebsd.org/changeset/base/214919

Log:
  Bugfix: Set the bit that marks a device number in use.
  This would cause a panic when disconnecting the second serial device.
  
  Submitted by:	Lucius Windschuh

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	Sun Nov  7 14:39:40 2010	(r214918)
+++ head/sys/dev/usb/serial/usb_serial.c	Sun Nov  7 15:36:07 2010	(r214919)
@@ -200,9 +200,12 @@ ucom_unit_alloc(void)
 
 	mtx_lock(&ucom_bitmap_mtx);
 
-	for (unit = 0; unit < UCOM_UNIT_MAX; unit++)
-		if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0)
+	for (unit = 0; unit < UCOM_UNIT_MAX; unit++) {
+		if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0) {
+			ucom_bitmap[unit / 8] |= (1 << (unit % 8));
 			break;
+		}
+	}
 
 	mtx_unlock(&ucom_bitmap_mtx);
 


More information about the svn-src-all mailing list