git: 9front

Download patch

ref: 06abda3d3af9d951f15496076dde0ae1e5c6b8c6
parent: e1fdc800bb227e4e4c1a91c6a0586bf1e0b5ef15
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Apr 22 14:50:29 EDT 2013

ether8169: fix deadlock in allocation error case for attach. (thanks erik)

typo in error case, should qunlock() instead of qlock().

--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -765,11 +765,13 @@
 			ctlr->rd = nil;
 			free(ctlr->dtcc);
 			ctlr->dtcc = nil;
-			qlock(&ctlr->alock);
+			qunlock(&ctlr->alock);
 			error(Enomem);
 		}
 		ctlr->init = 1;
 		kproc("rtl8169", rtl8169reseter, edev);
+
+		/* rtl8169reseter() does qunlock(&ctlr->alock) when complete */
 		qlock(&ctlr->alock);
 	}
 	qunlock(&ctlr->alock);
--