Re: FTDI removal oops

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

 



On Sun, 2009-05-17 at 16:52 -0400, Alan Stern wrote:
> On Sun, 17 May 2009, David Woodhouse wrote:
> 
> > When I remove the device, ftdi_sio_port_remove() calls
> > usb_set_serial_port_data(port, NULL);
> > 
> > When I then close minicom, it dereferences that NULL pointer:
> 
> See this thread:
> 
> 	http://marc.info/?t=124221380600004&r=1&w=2
> 
> Daniel never replied to my last message, so I don't know what happens 
> if one fixes his patch the way I suggested.

Yes, this fixes it.

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 0ab8474..2b870e6 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1487,14 +1488,8 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
 
 	remove_sysfs_attrs(port);
 
-	/* all open ports are closed at this point
-	 *    (by usbserial.c:__serial_close, which calls ftdi_close)
-	 */
-
-	if (priv) {
-		usb_set_serial_port_data(port, NULL);
-		kref_put(&priv->kref, ftdi_sio_priv_release);
-	}
+	cancel_delayed_work_sync(&priv->rx_work);
+	kref_put(&priv->kref, ftdi_sio_priv_release);
 
 	return 0;
 }

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@xxxxxxxxx                              Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux