Re: [PATCH]usblp read race
Pete Zaitcev <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Organization | Red Hat, Inc. |
| Message-ID | <[email protected]> |
On Tue, 15 May 2007 05:10:36 +0200, Oliver Neukum <[email protected]> wrote: > 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. You are quite right, thanks. The oddest thing though, I tested this path by running cat </dev/usb/lp0 and ^C, and nothing bad happened. Mutex debugging didn't catch it. > 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. Actually yes, I did not preserve what the old driver did here, sorry. But oddly enough, it only returned ENOMEM for writes, but not reads. I changed this to match the legacy. -- Pete ------------------------------------------------------------------------- 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