Re: [PATCH v12 05/14] x86/sgx: Implement basic EPC misc cgroup functionality

From: Huang, Kai
Date: Fri Apr 19 2024 - 18:22:24 EST




> Documentation of task_get_css() says it always
> returns a valid css. This function is used by get_current_misc_cg() to get
> the css refernce.
>
>
> /**
> * task_get_css - find and get the css for (task, subsys)
> * @task: the target task
> * @subsys_id: the target subsystem ID
> *
> * Find the css for the (@task, @subsys_id) combination, increment a
> * reference on and return it. This function is guaranteed to return a
> * valid css. The returned css may already have been offlined.
> */
> static inline struct cgroup_subsys_state *
> task_get_css(struct task_struct *task, int subsys_id)

Ah, I missed this comment.

This confirms my code reading too.

>
>
> If you look at the code of this function, you will see it does not check
> NULL either for task_css().
>
> So I think we are pretty sure here it's confirmed by this documentation
> and testing.

Yeah agreed. Thanks.