lkml.org 
[lkml]   [2000]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] lock troubles in pre6-2
On Sat, Aug 05, 2000 at 03:06:07PM -0700, Andy Chou wrote:
> Here is a more complete listing of the issues found by a compiler-based
> checker after being filtered by me. The checker essentially checks that
> spin locks, interrupts, and bh's are paired up in functions, warning when
> the function can exit holding a lock, with interrupts disabled, or while
> bh's are disabled. It also tries to check for double locks/unlocks within
> the same function, and also restoring of flags not saved within the same
> function.
>
> I had to filter out ~250 false positives, the ones here are ones I've
> looked at at least briefly so there should be at least a few bugs :)

There is definitely a problem in the usb-ohci.c file.

Attached is a patch to fix it against 2.4.0-test6-pre5.

Thanks a lot for doing this.

greg k-h

--
greg@(kroah|wirex).com
diff -Naur -X /home/greg/linux/dontdiff linux-2.4.0-test6-pre5/drivers/usb/usb-ohci.c linux-2.4.0-test6-pre5-greg/drivers/usb/usb-ohci.c
--- linux-2.4.0-test6-pre5/drivers/usb/usb-ohci.c Sun Aug 6 08:47:46 2000
+++ linux-2.4.0-test6-pre5-greg/drivers/usb/usb-ohci.c Sun Aug 6 08:50:52 2000
@@ -960,13 +960,20 @@
ed = ed_ret = &(usb_to_ohci (usb_dev)->ed[(usb_pipeendpoint (pipe) << 1) |
(usb_pipecontrol (pipe)? 0: usb_pipeout (pipe))]);

- if((ed->state & ED_DEL) || (ed->state & ED_URB_DEL))
- return NULL; /* pending delete request */
+ if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) {
+ /* pending delete request */
+ spin_unlock (&usb_ed_lock);
+ return NULL;
+ }

if (ed->state == ED_NEW) {
ed->hwINFO = cpu_to_le32 (OHCI_ED_SKIP); /* skip ed */
OHCI_ALLOC (td, sizeof (*td)); /* dummy td; end of td list for ed */
- if(!td) return NULL; /* out of memory */
+ if (!td) {
+ /* out of memory */
+ spin_unlock (&usb_ed_lock);
+ return NULL;
+ }
ed->hwTailP = cpu_to_le32 (virt_to_bus (td));
ed->hwHeadP = ed->hwTailP;
ed->state = ED_UNLINK;
\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.167 / U:1.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site