From 4027df884e1941d4f4203d19b9ad5861af5fb9fd Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 10 Mar 2022 09:48:42 -0500 Subject: [PATCH] kernel/vfs: Fix mismatched frees of vnodes. Regression from yesterday's commit. Fixes #17642. Hopefully this is all of them. --- src/system/kernel/fs/vfs.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 88663b34d8..7862cb1a56 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -967,7 +967,7 @@ create_new_vnode_and_lock(dev_t mountID, ino_t vnodeID, struct vnode*& _vnode, rw_lock_write_lock(&sVnodeLock); struct vnode* existingVnode = lookup_vnode(mountID, vnodeID); if (existingVnode != NULL) { - free(vnode); + object_cache_free(sVnodeCache, vnode, 0); _vnode = existingVnode; _nodeCreated = false; return B_OK; @@ -979,7 +979,7 @@ create_new_vnode_and_lock(dev_t mountID, ino_t vnodeID, struct vnode*& _vnode, if (!vnode->mount || vnode->mount->unmounting) { rw_lock_read_unlock(&sMountLock); rw_lock_write_unlock(&sVnodeLock); - free(vnode); + object_cache_free(sVnodeCache, vnode, 0); return B_ENTRY_NOT_FOUND; } @@ -1261,7 +1261,7 @@ restart: remove_vnode_from_mount_list(vnode, vnode->mount); rw_lock_write_unlock(&sVnodeLock); - free(vnode); + object_cache_free(sVnodeCache, vnode, 0); return status; } @@ -3837,7 +3837,7 @@ restart: locker.Lock(); sVnodeTable->Remove(vnode); remove_vnode_from_mount_list(vnode, vnode->mount); - free(vnode); + object_cache_free(sVnodeCache, vnode, 0); } } else { // we still hold the write lock -- mark the node unbusy and published