git: plan9front

Download patch

ref: 6a8125283c2812c71ecdd7f5f5f00bbf4dbb32c2
parent: 54f52b305a79c3534f2ff0039b4cbebde43b5704
author: mia soweli <inbox@tachibana-labs.org>
date: Sat Apr 19 15:21:14 EDT 2025

etheri225: free the block list, not the block

if there was an error, we need to free the entire block list
or we will leak memory.

--- a/sys/src/9/pc/etheri225.c
+++ b/sys/src/9/pc/etheri225.c
@@ -643,6 +643,8 @@
 static void
 i225txattach(Ctlr *c)
 {
+	uvlong pa;
+
 	/* disable transmit and the transmit ring during configuration */
 	csr32w(c, Rtxctrl, csr32r(c, Rtxctrl) & ~TXCenable);
 	csr32w(c, Rtxrctrl, 0);
@@ -661,9 +663,11 @@
 	csr32w(c, Rtxrptr, c->tx.ptr);
 	csr32w(c, Rtxrptrtail, c->tx.ptrtail);
 	csr32w(c, Rtxrlen, c->tx.len * 16);
-	csr32w(c, Rtxraddr, PCIWADDR(c->tx.desc));
-	csr32w(c, Rtxraddrhi, PCIWADDR(c->tx.desc) >> 32);
 
+	pa = PCIWADDR(c->tx.desc);
+	csr32w(c, Rtxraddr, pa);
+	csr32w(c, Rtxraddrhi, pa >> 32);
+
 	/* enable transmit and the transmit ring */
 	csr32w(c, Rtxrctrl, TXRthreshp | TXRthreshh | TXRthreshw | TXRcount | TXRgran | TXRenable);
 	csr32w(c, Rtxctrl, csr32r(c, Rtxctrl) & ~TXCcthresh);
@@ -858,9 +862,9 @@
 
 		/* if this is an error, concatenate and free */
 		if (d.status & RDerr) {
+			freeblist(bl);
 			bl = nil;
 			blt = nil;
-			freeblist(b);
 			goto next;
 		}
 
--