Re: [syzbot] [cgroups?] KASAN: slab-use-after-free Read in pressure_write
From: Edward Adam Davis
Date: Thu Apr 09 2026 - 09:06:29 EST
#syz test
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 4ca3cb993da2..c42e4d9930fa 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4281,7 +4281,9 @@ static void cgroup_file_release(struct kernfs_open_file *of)
cft->release(of);
put_cgroup_ns(ctx->ns);
kfree(ctx);
+ mutex_lock(&of->mutex);
of->priv = NULL;
+ mutex_unlock(&of->mutex);
}
static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,