[Devel] [PATCH vz10 12/14] ve: initialize ve0.css with CSS_NO_REF

Eva Kurchatova eva.kurchatova at virtuozzo.com
Fri Jun 26 01:08:14 MSK 2026


ve0.css lacked CSS_NO_REF, causing a NULL percpu_ref dereference in
css_get() during early boot: net_ns_init() calls get_ve() ->
css_get() before cgroup_init() has initialized the reference
counter.

Set ve0.css.flags = CSS_NO_REF since ve0 is a permanent singleton
that must never be freed.  This is consistent with how
cgroup_init_subsys() marks all root css objects.

Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix kunit
---
 kernel/ve/ve.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index a4d445c80333..a6600eed652b 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -50,6 +50,7 @@ static struct kmem_cache *ve_cachep;
 static DEFINE_PER_CPU(struct kstat_lat_pcpu_snap_struct, ve0_lat_stats);
 
 struct ve_struct ve0 = {
+	.css			= { .flags = CSS_NO_REF },
 	.ve_name		= "0",
 	.start_jiffies		= INITIAL_JIFFIES,
 
-- 
2.54.0



More information about the Devel mailing list