• Lai Jiangshan's avatar
    cgroups: fix probable race with put_css_set[_taskexit] and find_css_set · 146aa1bd
    Lai Jiangshan authored
    put_css_set_taskexit may be called when find_css_set is called on other
    cpu.  And the race will occur:
    
    put_css_set_taskexit side                    find_css_set side
    
                                            |
    atomic_dec_and_test(&kref->refcount)    |
        /* kref->refcount = 0 */            |
    ....................................................................
                                            |  read_lock(&css_set_lock)
                                            |  find_existing_css_set
                                            |  get_css_set
                                            |  read_unlock(&css_set_lock);
    ....................................................................
    __release_css_set                       |
    ....................................................................
                                            | /* use a released css_set */
                                            |
    
    [put_css_set is the same. But in...
    146aa1bd
cgroup_debug.c 2.04 KB