--- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6381,6 +6381,10 @@ void cgroup_sk_alloc(struct sock_cgroup_ return; } + /* Don't associate the sock with unrelated interrupted task's cgroup. */ + if (in_interrupt()) + return; + rcu_read_lock(); while (true) { --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6806,6 +6806,10 @@ void mem_cgroup_sk_alloc(struct sock *sk return; } + /* Do not associate the sock with unrelated interrupted task's memcg. */ + if (in_interrupt()) + return; + rcu_read_lock(); memcg = mem_cgroup_from_task(current); if (memcg == root_mem_cgroup)