[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#498293: linux-image-2.6.26-1-686: mos7840 USB serial driver fails to work and causes kernel OOPS with 2.6.26-4



mos7840_startup tries to use serial->minor for port number calculation but it
is uninitialized yet. It happened to work for single adapter when serial->minor
was 0, but now for some reason it is not and startup breaks. The attached
patch fixes the issue, but there's still some bug in deinitialization code,
which leads to NULL pointer dereference if mos7840_startup was unsuccessful.

--- a/drivers/usb/serial/mos7840.c	2008-11-16 09:55:34.000000000 +0700
+++ b/drivers/usb/serial/mos7840.c	2008-11-16 09:56:20.000000000 +0700
@@ -2534,9 +2534,7 @@
 		mos7840_set_port_private(serial->port[i], mos7840_port);
 		spin_lock_init(&mos7840_port->pool_lock);
 
-		mos7840_port->port_num = ((serial->port[i]->number -
-					   (serial->port[i]->serial->minor)) +
-					  1);
+		mos7840_port->port_num = i + 1;
 
 		if (mos7840_port->port_num == 1) {
 			mos7840_port->SpRegOffset = 0x0;



Reply to: