Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp560447imu; Wed, 2 Jan 2019 11:55:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN6hJGr4NDKa5XW33IYxrc4uo2kbHn9AFCw3rX/1aohc028YwCkF73hh/1RTbDmc03dOPLfH X-Received: by 2002:a62:6503:: with SMTP id z3mr44466164pfb.169.1546458943377; Wed, 02 Jan 2019 11:55:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546458943; cv=none; d=google.com; s=arc-20160816; b=AwlNmkcsXzHFKdVrrHm0nOFDi5xh1OOUwagLOdmsmQ1ceZPIgDnEurbwdGxIBeWP0/ L2aJVR8vIQoMLKpFudo4IG9thpA87k0I5cFNn09Sgt2NhYGfThytntW0O8D11Fs38XRK v2Diw4ZQKOHrEHJTC0kQiOR8RbDzbAFezQHQp17N88Gewf7Yyu6PyJbnQkNM03V+0Mcq 15t6v2pnCD7q98zVWYrbjTFnSvVkqjcaTgb74dT30O42bQmC2b+Q1Vateqq2g6UjfXjc ed8qv9cpDcXyMgXlv0ExdJqziDbCMjS1/e8lG0MEDzzdxwOfmQeq9Mzu71v/iKdlENkC LWuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=5dUXWnMYVxK4GhlE9mU3i7S+YQhp/yuwfcvNZh6pQ54=; b=bv2V4j/3riYmppbr3Y1i8R+aqH9C6MaJlnXhjo7T6ZlEQdhn9uMNY4d8l75Gp4ruAi usNLi54AWAkmgtcKohn94rgJxz6/foVTqrnFRVcz/l9G+fmHP3kMZSFgxeyIbT3E86s1 tkeFM4H6oEdcrfN5m957UDzoA96h0a8rC2xHE3CFZyZDRXlkzP8pz/RjW/l6ZckGJUbC arKIW80jxoQCWa2RfExYuXMpoKzMOPP75HtCU9+URsK+LWvwImEr/NtrhkX4Dgzd0MJl OxynHnB2kOc1INOdnWaC2taOyYW1KsinKq+ljqe7kpcX85c4PLy9pkFcYEdX+NlXCcX/ 9/ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qwipEX4w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h88si54703196pfa.49.2019.01.02.11.55.28; Wed, 02 Jan 2019 11:55:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qwipEX4w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbfABSCT (ORCPT + 99 others); Wed, 2 Jan 2019 13:02:19 -0500 Received: from mail-pg1-f202.google.com ([209.85.215.202]:38364 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726910AbfABSCT (ORCPT ); Wed, 2 Jan 2019 13:02:19 -0500 Received: by mail-pg1-f202.google.com with SMTP id x26so27487060pgc.5 for ; Wed, 02 Jan 2019 10:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=5dUXWnMYVxK4GhlE9mU3i7S+YQhp/yuwfcvNZh6pQ54=; b=qwipEX4wIkJkoVONyw3px8ydt+BiUWSb5U5RBPSsg7mhqCD+4qDp9Uj7JYhb/A9Wor HGqBh8MUbe7wxfjpQpqc+O8AenWmE4OjT/7XjR4dKHO72AkllbS6mYl+xwh2rAwMGRVy BeEtch55uq4z+z+HihCDU/thB4jlyVfn7Ax0WKYyWHtP4mvf1pkAT/gw9M1obguZFDwz VXYecv1XxqTFYnefuQotftd9giuHUU/3eX7wCghZm0IGTbQDkI4F3ArxMZGS8pKURKGH GWEb7bvAiTowOkeKfzxgaSbx7UHm1gD5UZrvAN4lhg6X5eSgig7+6g51ewHZVobYp4u5 SpAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=5dUXWnMYVxK4GhlE9mU3i7S+YQhp/yuwfcvNZh6pQ54=; b=ldOK5IgKid/evOJX3j9V5h02Ug/gNik0lYAVEb5CAhHptiJ45UpXh0krJisIYsOHNT RCsLDA1Zw+SdaA5xb75Jq+woiiWbpHFrAii/IPncfO07pysxuEnv4SVUuy+3F1t/TiNX FYGEifPJOJRTT4RjwBxarF6c/1EBVx3U7bOskAQRy+5LcAwoUzJRfjwndO1luwdlNyIX qNN67gpxUwC7W/pfXxVsZUFRmO+sCcWlw7I2/3cK9GlP5m7TFkYrgBc5lBuv/OiRyexd /g8xUzeK5+uDw8HKvWNLIrwUwDp18Hfdno2zrvCGRsNT97N1KvL/wgBFNJ0kSC4SMHcc n+Vw== X-Gm-Message-State: AA+aEWYpAI6c5NVSIFgVcfuQeAJqQpHXOoNyWwvU9NrFuweOhuF0JFg9 zfVi6BQWGeP+LuVp+hA0qOedrufSRpJCMA== X-Received: by 2002:aa7:8714:: with SMTP id b20mr20428221pfo.85.1546452138509; Wed, 02 Jan 2019 10:02:18 -0800 (PST) Date: Wed, 2 Jan 2019 10:01:45 -0800 Message-Id: <20190102180145.57406-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.1.415.g653613c723-goog Subject: [PATCH] fork, memcg: fix cached_stacks case From: Shakeel Butt To: Rik van Riel , Roman Gushchin , Michal Hocko , Andrew Morton Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Shakeel Butt , Johannes Weiner , Tejun Heo , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail") fixes a crash caused due to failed memcg charge of the kernel stack. However the fix misses the cached_stacks case which this patch fixes. So, the same crash can happen if the memcg charge of a cached stack is failed. Fixes: 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail") Signed-off-by: Shakeel Butt Cc: Rik van Riel Cc: Roman Gushchin Cc: Michal Hocko Cc: Johannes Weiner Cc: Tejun Heo Cc: --- kernel/fork.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/fork.c b/kernel/fork.c index e4a51124661a..593cd1577dff 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -216,6 +216,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) memset(s->addr, 0, THREAD_SIZE); tsk->stack_vm_area = s; + tsk->stack = s->addr; return s->addr; } -- 2.20.1.415.g653613c723-goog