[bug report] cgroup: re-use the parent pointer in cgroup_destroy_locked()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Roman Gushchin,

This is a semi-automatic email about new static checker warnings.

The patch 5a621e6c958e: "cgroup: re-use the parent pointer in 
cgroup_destroy_locked()" from Aug 2, 2017, leads to the following 
Smatch complaint:

    kernel/cgroup/cgroup.c:5531 cgroup_destroy_locked()
    error: we previously assumed 'parent' could be null (see line 5515)

kernel/cgroup/cgroup.c
  5514	
  5515		if (parent && cgroup_is_threaded(cgrp))
                    ^^^^^^
Apparently this check has been around for 2 years and we've never Oopsed
so it can probably be deleted.

  5516			parent->nr_threaded_children--;
  5517	
  5518		spin_lock_irq(&css_set_lock);
  5519		for (tcgrp = cgroup_parent(cgrp); tcgrp; tcgrp = cgroup_parent(tcgrp)) {
  5520			tcgrp->nr_descendants--;
  5521			tcgrp->nr_dying_descendants++;
  5522			/*
  5523			 * If the dying cgroup is frozen, decrease frozen descendants
  5524			 * counters of ancestor cgroups.
  5525			 */
  5526			if (test_bit(CGRP_FROZEN, &cgrp->flags))
  5527				tcgrp->freezer.nr_frozen_descendants--;
  5528		}
  5529		spin_unlock_irq(&css_set_lock);
  5530	
  5531		cgroup1_check_for_release(parent);
                                          ^^^^^^
If "parent" were NULL it would Oops here.

  5532	
  5533		cgroup_bpf_offline(cgrp);

regards,
dan carpenter



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux