Re: error handling in tty_open

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Am Montag, 26. März 2007 20:26 schrieb John:
> Hi,
> No, I don't see how it can work.
> 
> When a device is disconnected serial_open will
> fail at the very beginning

You are right. All failures must be handled. I'll make a new patch.
 
> But there may be a more serious problem.
> port is stored in tty->driver_data and 
> is shared among all files on the same device.
> 
> So, I wonder whether the following may happen:
> 
> proc A -> serial_open file 1 - success
> proc B -> serial_open file 2 - failure 
>   - set cleaning_up flag
> proc A -> serial_close file 1 
>   - aborted because of cleaning_up flag
> proc B -> serial_close file 2
>   - proceeded to close file 2 even if it was
>   never opened.

AFAICT both opening and closing a tty is done with BKL held.
As long as we don't sleep after incrementing cleaning_up we should
be safe. I'll check again.

> By the way, did you receive my patch,
> which I sent on Friday for review?
> E-Mail title was called
> "[PATCH 1/1] race condition fixes for usb-serial - new
> attempt - for review"

Yes. A bit of patience please.

	Regards
		Oliver

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.