Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] fs: mixing goto and scoped_guard in __set_oom_adj violates cleanup rules
--

commit da2e9c3ae4d6602d37bc777bfafc43d2f081d385
Author: Ye Liu <[email protected]>

fs: convert process/thread iterators to for_each_*_rculock
    
Replace the manual rcu_read_lock()/rcu_read_unlock() pairs combined
with for_each_process() and for_each_process_thread() loops in fs/
with the for_each_*_rculock() macros, which scope the RCU read lock
to the loop body via scoped_guard(rcu).

> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 58be389424605..2c47d838a1c76 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -1161,8 +1161,7 @@ static int __set_oom_adj(struct file *file, int 
> oom_adj, bool legacy)
>       if (mm) {
>               struct task_struct *p;
>  
> -             rcu_read_lock();
> -             for_each_process(p) {
> +             for_each_process_rculock(p) {

[Severity: Low]
Does introducing for_each_process_rculock() here violate the rule against
mixing scope-based cleanup and goto error handling in the same function?

This macro expands to scoped_guard(rcu), introducing scope-based cleanup into
__set_oom_adj(). However, this function already uses manual goto-based error
handling:

fs/proc/base.c:__set_oom_adj() {
    ...
                if (oom_adj < task->signal->oom_score_adj &&
                                !capable(CAP_SYS_RESOURCE)) {
                        err = -EACCES;
                        goto err_unlock;
                }
    ...
err_unlock:
        mutex_unlock(&oom_adj_mutex);
        put_task_struct(task);
        return err;
}

The subsystem guidelines require converting all resources in a function to
scope-based cleanup, or none at all, explicitly prohibiting mixing both in the
same function.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=13

Reply via email to