shithub: riscv

Download patch

ref: d31b10c42e29ba0befe9290164ec587d2a3ebb1e
parent: 3da0a627971a5ec4ca5c8253dbb798df56c5ddcb
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jul 8 19:01:14 EDT 2023

swap: fix pager nil pointer derefence when running out of procs

--- a/sys/src/9/port/devswap.c
+++ b/sys/src/9/port/devswap.c
@@ -183,12 +183,10 @@
 
 		i = ageclock;
 		do {
-			p = proctab(x++);
-			if(p == nil){
+			while((p = proctab(x++)) == nil){
 				if(++ageclock == i)
 					goto Killbig;
 				x = 0;
-				continue;
 			}
 		} while(p->state == Dead || p->noswap || !canqlock(&p->seglock));
 		up->psstate = "Pageout";