[SRU B/D/E/F/focal:linux-oem-5.6 0/2] cgroup refcount is bogus when cgroup_sk_alloc is disabled

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Mon Jul 27 13:28:38 UTC 2020

BugLink: https://bugs.launchpad.net/bugs/1886860

This is a followup from LP: #1886668.

When net_prio and net_cls cgroups are used, cgroup refcount is bogus, as it's
not incremented anymore, but decremented when sockets are closed.

This might lead to crashes possibly because of use-after-free when packets are
received as shown in LP #1886668.

[Test case]
Ran reproducer from comment #2.

[Regression potential]
We could break the use of cgroup bpf. The use of cgroup bpf looks to still be
working from the reproducer.

Cong Wang (2):
  cgroup: fix cgroup_sk_alloc() for sk_clone_lock()
  cgroup: Fix sock_cgroup_data on big-endian.

 include/linux/cgroup-defs.h |  8 ++++++--
 include/linux/cgroup.h      |  4 +++-
 kernel/cgroup/cgroup.c      | 29 ++++++++++++++++++-----------
 net/core/sock.c             |  2 +-
 4 files changed, 28 insertions(+), 15 deletions(-)


More information about the kernel-team mailing list