Re: [PATCH 2/6] cgroup: Allocate cgroup_file_ctx for kernfs_open_file->priv
From: Michal Koutný
Date: Tue Dec 14 2021 - 12:04:00 EST
On Mon, Dec 13, 2021 at 09:18:29AM -1000, Tejun Heo <tj@xxxxxxxxxx> wrote:
> static int cgroup_file_open(struct kernfs_open_file *of)
IIUC, this is common to v1 files too, i.e. cgroup_pidlist_start too.
> static void cgroup_file_release(struct kernfs_open_file *of)
> {
> struct cftype *cft = of_cft(of);
> + struct cgroup_file_ctx *ctx = of->priv;
>
> if (cft->release)
> cft->release(of);
> + kfree(ctx);
Here it could free a pointer to pidlist that has different lifecycle.
Perhaps add one more slot into cgroup_file_ctx for the pidlist pointer?