Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5244847imu; Tue, 15 Jan 2019 13:59:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN5yZvu5U75791Ur8MFyS/PLvdMOGryIGIOURpuKaIStNlmpwnf2LUyG1xRcf63ovwItUc60 X-Received: by 2002:a62:7a8b:: with SMTP id v133mr6313451pfc.159.1547589572635; Tue, 15 Jan 2019 13:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547589572; cv=none; d=google.com; s=arc-20160816; b=GlehyeezgXY2kgirgbh9Oy96Gl828IkjrS/UDlj7KpgvoaQjqyTewLoCAEfiI0knCY xYYBIOB39nV6FUAN54V1gvNRO+NPP75kXBr6naXZn2TRsVqqkr7uc7J5DPfGczASGrjS yi9idorjGcYeoBSqDY0os5zmE0L30ddW7K3Jmkw8+sxu5L8r6rYedLJGh43BBJV968jY MxmctQAoF/tcE+Exski+8V7e1wzv6RI5Hh3iT7VK1sd2g7iFf04BZJ7mo1IAmE6fNx6Z +VdYY8Je+2gHXlIIRxpzfFrSEJlOsDvHIlD162lpM4n5dLb9W/+b9Ua8nPQSeCKfkSSp nUVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mLM61s3Uaa6wo4I1ycruB/1yJOp4kZNZBJKWPamp8Js=; b=SZO0KXYHQSVJj56cIwELkLQPJDl400xhAHj4HOSB7kjoqPI0N8b/4k90p0U5UjvjTA yqGlFG2AjYtN21eYvYom/yvD6PkYR5HsDoOpyI7M7aO6HW4c7IzdMZbmxBDa3rVb3Ze4 I2VjN55I4iuCsLLHYYjnCTRT8fQNjLqcHDUpn1zbYGLt5JW0MbDyLh846qCQCxVdf3jf VeVDRCmnXwOYqDZJTZZsPo82Cu9zP8Tg+oVF3h3guUCxJ/tGjZMXaoReIgrb/CyG76kO +50Pt3YL+ynhkop2J+jlF/gn2G+BjVpbSPVrTWdcKvd5zojkf4eH7Jy30HWysmxEphJx tvEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bxO0LhCd; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i90si4556250pli.135.2019.01.15.13.59.13; Tue, 15 Jan 2019 13:59:32 -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=@kernel.org header.s=default header.b=bxO0LhCd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387559AbfAOQoc (ORCPT + 99 others); Tue, 15 Jan 2019 11:44:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:34066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387534AbfAOQo3 (ORCPT ); Tue, 15 Jan 2019 11:44:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14F5F20657; Tue, 15 Jan 2019 16:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547570668; bh=dU/0bNoLFCl/Pm3nYZfbgbWFS7t9nBYleLry7RwL7Lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxO0LhCd1nc141tVSdT6yLMQwJ/sc+eJR0VH6m6IqWTzRLb+0MDY57TZoDd+Zqevf qqKMK3Zpf1fpwRVqHKjbrTqYStJtxvcF/H1IzXtDxSvy2YqRje+RaVcMLZx1QEaQ4u ycFeOfzTMMwFqL3cjkIunrlN/rpVA4jKdAHHPq5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shakeel Butt , Michal Hocko , Rik van Riel , Roman Gushchin , Johannes Weiner , Tejun Heo , Andrew Morton , Linus Torvalds Subject: [PATCH 4.20 27/57] fork, memcg: fix cached_stacks case Date: Tue, 15 Jan 2019 17:36:08 +0100 Message-Id: <20190115154912.206139055@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190115154910.734892368@linuxfoundation.org> References: <20190115154910.734892368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shakeel Butt commit ba4a45746c362b665e245c50b870615f02f34781 upstream. 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. Link: http://lkml.kernel.org/r/20190102180145.57406-1-shakeelb@google.com Fixes: 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail") Signed-off-by: Shakeel Butt Acked-by: Michal Hocko Acked-by: Rik van Riel Cc: Rik van Riel Cc: Roman Gushchin Cc: Johannes Weiner Cc: Tejun Heo Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/fork.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/fork.c +++ b/kernel/fork.c @@ -221,6 +221,7 @@ static unsigned long *alloc_thread_stack memset(s->addr, 0, THREAD_SIZE); tsk->stack_vm_area = s; + tsk->stack = s->addr; return s->addr; }