On Wed, May 04, 2005 at 10:21:09AM -0300, Flavio Leitner wrote:
>
> Hello,
>
> I'm testing with pl2303 but oops show at serial_open() then
> I don't know if happens with other modules too. The program
> that trigger bug is attached below and just open(), tcsetattr()
> and close().
I think we found the race condition:
Process 1 = P1
Process 2 = P2
P1:
serial_open()
++open_count -----------> = 1
if (open_count == 1)
tty->driver_data = port
port->tty = tty;
pl2303_open()
serial_close()
--open_count ------------> = 0
if (open_count == 0)
pl2303_close()
schedule_timeout()
P1 is sleeping here waitting buffers be drained and gives the opportunity
for P2 open device too.
P2:
serial_open()
++open_count ----------> = 1
if (open_count == 1)
tty->driver_data = port
port->tty = tty;
pl2303_open()
return Ok!
P2 is stopped here and gives a chance of P1 continue and here is a problem
when P1 cames back to serial_close():
port->tty->driver_data = NULL;
port->tty = NULL;
Now we have open_count = 1 and port->tty = NULL and P2 with
a valid file descriptor. If P2 do ioctl() kernel will oopses here:
struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
Any suggestion how to solve it?
--
Fl�vio Bruno Leitner <[EMAIL PROTECTED]>
[0EA2 7F40 4CF4 1E63 4AF6 33C0 3E10 E205 F251 EDDA]
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel