kernel: check object refcount before performing a recursive deletion

This commit is contained in:
2026-02-23 18:43:11 +00:00
parent b1ffdcf2bc
commit fd1bc0ad5f

View File

@@ -110,7 +110,16 @@ static void object_cleanup(struct object *obj, unsigned long flags)
struct queue_entry *entry = queue_pop_front(&queue); struct queue_entry *entry = queue_pop_front(&queue);
struct object *child = NULL; struct object *child = NULL;
obj->ob_type->ob_ops.destroy_recurse(entry, &child); obj->ob_type->ob_ops.destroy_recurse(entry, &child);
if (child) { if (!child) {
continue;
}
if (child->ob_refcount > 1) {
child->ob_refcount--;
continue;
}
if (child->ob_refcount == 0 && child->ob_handles == 0) {
__cleanup(child, &queue); __cleanup(child, &queue);
} }
} }