Re: [PATCH 8/8] usb-serial: straighten out serial_open

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

 



2009/9/3 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>:
> On Thu, 3 Sep 2009, Ming Lei wrote:
>
>> > -       ++port->port.count;
>> > +       spin_lock_irq(&port->port.lock);
>> > +       if (!tty_hung_up_p(filp))
>> > +               ++port->port.count;
>> > +       spin_unlock_irq(&port->port.lock);
>>
>> The lock is still needed  in usb_console_setup() to protect port->port.count,
>> isn't it?
>
> Is it?  I don't know.  The lock is needed to protect against concurrent
> open, close, and hangup events.  Does usb_console_setup() run before
> any of those things can occur?

IMHO, /dev/ttyUSB0 may be created before usb_console_setup(), so it
is possible that open() and usb_console_setup() are concurrent.

>
> One thing that _is_ clear is that usb_console_setup() needs to release
> serial->disc_mutex.  I didn't notice that it called
> usb_serial_get_by_index().
>
> Alan Stern
>
>

-- 
Lei Ming
--
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