shithub: gefs

Download patch

ref: 9b49a47d09b75649596e7c63df4ec59060a1bdd0
parent: 9884d4acb34576780f13e84d93551c93278b9212
author: Michael Forney <mforney@mforney.org>
date: Tue Apr 4 14:21:23 EDT 2023

user: fix freeing of previous users on reload

If we are reloading the users, the new list may have a different
length than the old list, which would result in an incorrect loop
bound when freeing the old list.

--- a/user.c
+++ b/user.c
@@ -230,10 +230,12 @@
 
 	wlock(&fs->userlk);
 	n = fs->users;
+	i = fs->nusers;
 	fs->users = users;
 	fs->nusers = nusers;
-	users = n;
 	wunlock(&fs->userlk);
+	users = n;
+	nusers = i;
 
 Error:
 	if(users != nil)