[PATCH]usblp read race
Oliver Neukum <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Organization | Novell |
| Message-ID | <[email protected]> |
Hi, thanks for reminding me about the read path. If two threads call read() at the same time, an urb may be submitted twice. Regards Oliver Signed-off-by: Oliver Neukum <[email protected]> ----- --- a/drivers/usb/class/usblp.c 2007-03-30 18:02:44.000000000 +0200 +++ b/drivers/usb/class/usblp.c 2007-03-30 18:11:17.000000000 +0200 @@ -781,6 +781,7 @@ count = -EAGAIN; goto done; } +lost_race: mutex_unlock(&usblp->mut); rv = wait_event_interruptible(usblp->wait, usblp->rcomplete || !usblp->present); mutex_lock(&usblp->mut); @@ -788,6 +789,8 @@ count = -EINTR; goto done; } + if (!usblp->rcomplete) + goto lost_race; } if (!usblp->present) { ------------------------------------------------------------------------- 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