shithub: riscv

Download patch

ref: 3869d7a8437e2a9902529cd68915dddcb43e6782
parent: a54804ed24165e4d9e3d433149f8535f6ce01058
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 23 22:11:37 EDT 2020

usbehci: avoid kproc() while holding poll lock

--- a/sys/src/9/port/usbehci.c
+++ b/sys/src/9/port/usbehci.c
@@ -2278,12 +2278,15 @@
 
 	if(poll->must != 0 && poll->does == 0){
 		lock(poll);
-		if(poll->must != 0 && poll->does == 0){
-			poll->does++;
-			print("ehci %#p: polling\n", ctlr->capio);
-			kproc("ehcipoll", ehcipoll, hp);
+		if(poll->must == 0 || poll->does != 0) {
+			unlock(poll);
+			return;
 		}
+		poll->does++;
 		unlock(poll);
+
+		print("ehci %#p: polling\n", ctlr->capio);
+		kproc("ehcipoll", ehcipoll, hp);
 	}
 }