Hello,

It's possible to unplug usb device and do tiocmset() and tiocmget() without
valid interface in pl2303 module.

The patch below check this and return -ENODEV if interface was removed.

(the patch is against bk of 2005-04-11.)

diff -purN linux-05-04-11/drivers/usb/serial/pl2303.c 
linux-05-04-11.usb/drivers/usb/serial/pl2303.c
--- linux-05-04-11/drivers/usb/serial/pl2303.c  2005-04-11 10:58:41.000000000 
-0300
+++ linux-05-04-11.usb/drivers/usb/serial/pl2303.c      2005-04-11 
11:09:04.000000000 -0300
@@ -677,6 +677,9 @@ static int pl2303_tiocmset (struct usb_s
        unsigned long flags;
        u8 control;
 
+       if(!usb_get_intfdata(port->serial->interface))
+               return -ENODEV;
+
        spin_lock_irqsave (&priv->lock, flags);
        if (set & TIOCM_RTS)
                priv->line_control |= CONTROL_RTS;
@@ -702,6 +705,9 @@ static int pl2303_tiocmget (struct usb_s
 
        dbg("%s (%d)", __FUNCTION__, port->number);
 
+       if(!usb_get_intfdata(port->serial->interface))
+               return -ENODEV;
+
        spin_lock_irqsave (&priv->lock, flags);
        mcr = priv->line_control;
        status = priv->line_status;

-- 
Fl�vio Bruno Leitner <[EMAIL PROTECTED]>
[0EA2 7F40 4CF4 1E63 4AF6  33C0 3E10 E205 F251 EDDA]


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to