Re: [PATCH]usblp read race

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Am Dienstag, 15. Mai 2007 00:24 schrieb Pete Zaitcev:
> Oliver, I've removed wait_event. Please have a look if you have a moment.
> This also should fix the endless loop upon a write error, which Jochen
> reported.
> 
> Unfortunately, the diffstat is unfavourable: +247 -155. This may be the
> fault of added comments, because the module itself lost about 700 bytes
> on x86_64.  I think the code is more regular and clean now, but
> please let me know if I muddied waters.
> 
> I made a special effort to preserve all oddities of the current driver,
> because it had a history of "cleanups" causing regressions. Again, this
> is something to pay attention to.

Hi,

firstly, you fixed the ordering race.
However:

1. usblp_read():

	rv = usblp_rwait_and_lock(usblp, !!(file->f_flags & O_NONBLOCK));
	if (rv < 0) {
		count = rv;
		goto done;
	}

If you get a signal, the mutex will _not_ be locked, yet it'll be unlocked.

2. usblp_write():	
	if ((rv = usb_submit_urb(usblp->writeurb, GFP_KERNEL)) < 0) {
			usblp->wcomplete = 1;
			usblp->wstatus = 0;
			mutex_unlock (&usblp->mut);
			return writecount ? writecount : -EIO;

At least ENOMEM we'd probably like to report as such.

	Regards
		Oliver

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[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.