Skip to content

Commit 94a4acf

Browse files
Chen Ridonghtejun
authored andcommitted
cgroup/psi: Set of->priv to NULL upon file release
Setting of->priv to NULL when the file is released enables earlier bug detection. This allows potential bugs to manifest as NULL pointer dereferences rather than use-after-free errors[1], which are generally more difficult to diagnose. [1] https://lore.kernel.org/cgroups/[email protected]/T/#m8a3b3f88f0ff3da5925d342e90043394f8b2091b Signed-off-by: Chen Ridong <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 79f919a commit 94a4acf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/cgroup/cgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,6 +4182,7 @@ static void cgroup_file_release(struct kernfs_open_file *of)
41824182
cft->release(of);
41834183
put_cgroup_ns(ctx->ns);
41844184
kfree(ctx);
4185+
of->priv = NULL;
41854186
}
41864187

41874188
static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,

0 commit comments

Comments
 (0)