ref: 00ea2689cd9e51886b663fbce5a4ff966a3dd066
parent: a3fb3fb3df5e7898b5bfe141ddd76417bd50075a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Oct 21 07:06:35 EDT 2022
kernel: fix freeb() for custom pools Some ethernet drivers like ethervt6105M maintain a custom pool of Blocks using Block.free callback. To maintain that Block.list pointer is nil when reused, we have to clear it before returning it to the custom pool as the custom pool code is not aware of it. Also, poison Block.list pointer before free().
--- a/sys/src/9/port/allocb.c
+++ b/sys/src/9/port/allocb.c
@@ -107,6 +107,9 @@
* pool of uncached buffers and provide their own free routine.
*/
if(b->free != nil) {
+ b->next = nil;
+ b->list = nil;
+
b->free(b);
return;
}
@@ -113,6 +116,7 @@
/* poison the block in case someone is still holding onto it */
b->next = dead;
+ b->list = dead;
b->rp = dead;
b->wp = dead;
b->lim = dead;
--
⑨