From patchwork Mon Jun 11 17:54:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 10458609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C15896020F for ; Mon, 11 Jun 2018 17:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD2842858E for ; Mon, 11 Jun 2018 17:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FCF628591; Mon, 11 Jun 2018 17:55:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEBF12858E for ; Mon, 11 Jun 2018 17:55:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7630B6B0007; Mon, 11 Jun 2018 13:54:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6EDD56B0008; Mon, 11 Jun 2018 13:54:59 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CD896B000D; Mon, 11 Jun 2018 13:54:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by kanga.kvack.org (Postfix) with ESMTP id EB8176B0007 for ; Mon, 11 Jun 2018 13:54:58 -0400 (EDT) Received: by mail-lf0-f69.google.com with SMTP id g82-v6so3059198lfg.4 for ; Mon, 11 Jun 2018 10:54:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:dkim-signature:from:to:cc:subject :date:message-id:in-reply-to:references:mime-version :spamdiagnosticoutput:spamdiagnosticmetadata; bh=HPmIizF7jwP7eBORlMTK+69azwYZjJ+UfNEg/ErOo6U=; b=CWBwnk9KulmnskfbelkazfKtm2G2SK37vMzuzl9WIr+Ci9/UJSrnqJOKAhehO47fYt 8hHG5YqLiWNish2YDXtSl0ZsaVqVA3NLN6k0j8b8eNPRpE6lipt83tM2GPFhgMT72cRQ g/1lTaS739UWvKXCUvxPmxPjmyN93G0ffXSKxp4xPfXC0MxUbF5ufAlKNRXInXjRCYj7 M5vkN7TA0/lUB924t5dOXQMkZrRR6lk5E8isnkOecDn/QB607r5xfPaf4v7OthXMXeLa 6Hh/K8Yp+UZN7D4GKK/uwb0ZAOA0YWVaiX0kdy5dma5rhqOF8S7n2zR2Wxb35hH3MjnU 7btA== X-Gm-Message-State: APt69E18K2lpYIzvxqvjO5v/Ko3VAgpgfho/D41E9PaOADZGq6VNbFVB DcP8B3j9z1dxR3lSFW75fT6pARbC4dCKNhmk6XaNq1ByHbRQTm/9P0LYpBMUUMG2mtEwTrFCiCx wjxFJdb15oMRA8ldeZjxxjwehxb0hetSt7jd9uYJDyErnmpaL4Zd2UIUk/n80XBGO4w== X-Received: by 2002:a2e:8350:: with SMTP id l16-v6mr97853ljh.7.1528739698032; Mon, 11 Jun 2018 10:54:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJSHWsUFKwltqSJsPbVc5NiLJ4NMHYjQFbPkg2ibvhw7RirptbRJB3MY0XIhHx73EqfB5F6 X-Received: by 2002:a2e:8350:: with SMTP id l16-v6mr97810ljh.7.1528739696604; Mon, 11 Jun 2018 10:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528739696; cv=none; d=google.com; s=arc-20160816; b=BJASSw7/6a5dVGYFELZmFJgWsSxSWIpR/0TAu+7+El3a+E2zfYgWW510aPgae84rbz eiwYmSImi6OabTdM6WTLk8UISrv8WZ5WIY4G8oYTRt63P6ww3pHezc8ktrue4WORwM6n CVxtOnMAayqkafDdNfbxM26nxlB7BVlwhkg7s79gFi0SPJbMoEug0+CZWF/jcO6wrShu ZV3WqOcPJx4FKmsNjJPFpTxIwmtGHjqq/2CGdNsjKnMuNyt2hWbNUMJjpJjxD5XbQ+3c bhUhtHdvWvIaUHcBO07dgNCFxKZsYSSTqlJHVTztuzqljecptTUpCGXDqoXOwDzh7iKz mZ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-signature:arc-authentication-results; bh=HPmIizF7jwP7eBORlMTK+69azwYZjJ+UfNEg/ErOo6U=; b=XTjlF+Ih3HeYnwJao6FPYlXgw67fxMLHtJEZ+8v6dftRgi+vODqscrqVzVEm3b7XEK X+XjQyAj4WRqaGdvSCvR9ABgV60nv+HlR0IHhh6OODtSbTZV9dwMICzzrpHtkVrKTzYp xBTPgnbL6k2QBNXix85qBjGdEW/Gig5G8mU/RFm2hUlyCyG2hLRIGWaA8CiKlfBml3dU I26EgAzqY2b9H/Hp1of/n1XUrn3HY16TdHjv7+pVcYuAf0LGjhCIBHFERtHEWVPdLd99 YX/QoatubPoXp3TCKtdUeOd26Ged+/aPd/tAsQ3xodKzcejuLpc9owHPzZ/nBLnwTx02 mkHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=XeQBMHew; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=ZAbIiDry; spf=pass (google.com: domain of prvs=9700a3645f=guro@fb.com designates 67.231.145.42 as permitted sender) smtp.mailfrom=prvs=9700a3645f=guro@fb.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com. [67.231.145.42]) by mx.google.com with ESMTPS id p39-v6si8456086lfg.95.2018.06.11.10.54.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 10:54:56 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=9700a3645f=guro@fb.com designates 67.231.145.42 as permitted sender) client-ip=67.231.145.42; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=XeQBMHew; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=ZAbIiDry; spf=pass (google.com: domain of prvs=9700a3645f=guro@fb.com designates 67.231.145.42 as permitted sender) smtp.mailfrom=prvs=9700a3645f=guro@fb.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5BHn7FA027817; Mon, 11 Jun 2018 10:54:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=HPmIizF7jwP7eBORlMTK+69azwYZjJ+UfNEg/ErOo6U=; b=XeQBMHewNuB6nS2aswi00JXjHGxh0OncDGDoyzsgse0rP3J4wyCUAHyG/pK25qT3HU8C mRKe60tZe8Ay3uDBhHF6tiH7HKK73uM+Rs5OQvlfffAGEb5huqvtDhxiOvLSFouJVyuI tDg9PRTSAxEjL4D7c95Ky+YVwEIEWMbMX0A= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2jhtjf0kwq-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 11 Jun 2018 10:54:46 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.25) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 11 Jun 2018 13:54:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HPmIizF7jwP7eBORlMTK+69azwYZjJ+UfNEg/ErOo6U=; b=ZAbIiDrycEwfT4yAQj4d48xaSRxeUr3OQSL6mMGQeQDs3Q8PtY7f+LAx5tyKMkgqzKS3F1Wg3vXjBd6UXogAKB1HPbz4+Snkw8DwEpNKjCMWTbRbMXCMZH7/Q5ExezMwPBDVjWSjXZUdJm13LfZeNzDTU9nzn9sWaC+8gDQ8suY= Received: from castle.thefacebook.com (2620:10d:c090:200::4:49ec) by DM3PR15MB1083.namprd15.prod.outlook.com (2603:10b6:0:12::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Mon, 11 Jun 2018 17:54:41 +0000 From: Roman Gushchin To: Andrew Morton CC: Johannes Weiner , Michal Hocko , Tejun Heo , , , , Roman Gushchin Subject: [PATCH v2 1/3] mm: fix null pointer dereference in mem_cgroup_protected Date: Mon, 11 Jun 2018 10:54:16 -0700 Message-ID: <20180611175418.7007-2-guro@fb.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180611175418.7007-1-guro@fb.com> References: <20180611175418.7007-1-guro@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::4:49ec] X-ClientProxiedBy: MWHPR0201CA0080.namprd02.prod.outlook.com (2603:10b6:301:75::21) To DM3PR15MB1083.namprd15.prod.outlook.com (2603:10b6:0:12::9) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM3PR15MB1083; X-Microsoft-Exchange-Diagnostics: 1; DM3PR15MB1083; 3:ABHFeMLQGR1UXO+ZXXEkEMFBU5n+rgEi9DuRhrPQfAbphH0KVQQX8Tcb+wTnOl01wNvrXUa6V5/0GqagcilxSDK1oLO3AGNyHuKzh8Re4zmlKd+eVfDZvUI5AyUZeMho98ryBHKG7KeH33v9nXqeWBz7J2hsyM5k1gYrThkc3Htt0h+UhsrUlDiYM02hS1FVf+GYbA3Snhb8YlLVWEv72VEOZFnhQLx3J+ODuhEqgBa9JCI/a9D55J3B55pnexBf; 25:ZPduZCrC3shsLvohRjSIRL8HOiraLHIVuGTCg36C41Jx49X5XfI1mOFm5dNhOdLc8mdMA0M4RMESnYLSKt1TJZKuhmkFvMEWkD2v/twGQnbp9CJh+dLOtuXaF6iWmDwq1XA/xK3XxBL5l7bBu/1argRSTRnpAL5qJCRLzoF+tFej2I8D0Qk6/gqC1Am3lhEqm1cId2M663oMG5tRlNbqIgmuBQLHl4lWY0kNqguADDqvRP7SySq+D+SgVwvbGSllXmpl/JvI3+VfKjNSPgmWwwRgNVM+aq58vhTMpnQ6MQN6iit/gc83NeMPG2v2GCLxmwUTGy05ASAdLY5Hf06jrQ==; 31:W4ZJ27UYpCtXH3Hi7hyNGjQduxzA6hcR+qXhLpkIqV4nmniOOdBDGbWlRVhiJZdyOaJPdWiQUGC/RSaYe5P0pdg2XOZ+z+hlSN+KyelIh94VW1ADvzzIwp/7plxUHdUBmdZzSi4j+q6Cvd5sMe0vfXXdMqsW2HQCDmRzwJGpjxQ8wIdNNTYj19TzdAhehJQTyFGTTd/6+bH9aWcsalZrZ5rP0pNh5Qq43IbXUH0cft0= X-MS-TrafficTypeDiagnostic: DM3PR15MB1083: X-Microsoft-Exchange-Diagnostics: 1; DM3PR15MB1083; 20:Kz98tuvq1qhuCYUHBpmLzv36ON37ER4pWFAFjekJTpZltlyJ7FtKP5OBcB/1numaiDmY9fqLbFMk7tP6sn2yP5zNgY8teysV/9pNs8XkdKWYvroeLXJcvO3e3RM8UgwZTLYiqa6RrH84KkV3qr/YeBLkmBcrJC63mUCtdvdHuEA/ZNce5KuX5vay1Syj5SWISOy3+kl+F6EKoBjbmcueCI9TYoF6rjrrI1mW33+PazAzM18SdYoiMUEIn5JMknLuIWii5yscXgITtud7z9memFRHD6nCk6v2MjwhA3rZOPs/ZwzKmeGqHhnNa+F7QmsIg1QO51Zgv1YJRBYSDIrq/YaDQgkmxFyJ01TjxXeBMan7JQkFg9qeiX4GeUMbTkt7FK0z+xljp/5Rcsz3HadOCB4wTS5gbW6KzDcS59n2w9KvmCfMJLABQBPq7KbJnTL/n30ZWociX6dKBcAl2zE2hoBGl574CHM7Ne84jho6ERz8/q5RRfXiHdKjzGbHCf2H; 4:CAyqFxd7RCab4v5ijz1x+jVfpEWXdj2yUodYpux6Edvui2frgr6aOf5FHus+tPdCaaPivLwN+ptNaAU9ypmhB0Hqg3/+J+xdonLEJP43jKbGI2TVGCkmw3RVDbXxgnRPoAjwzaL05DgJ4pu7bsX+3k6DEAkNuo+iBbUN9ggoSdbCF/IFlggGp+7ESk0G8kryvL3Kg+VE9yR0krUeAyc68wDquMaMcp1lBrWF4ShuHA37uuxO78GNED9Hrp88FnRUF8WlxHpGGYrLtcGlXq3aW6aW4cGFkomy0D4Qjd2cmEWgeTpS2898QoqfR5hzNWfjZerwjhUUeAz6pYGJcAdMarxvudcYeohooAEV5Dn6gbAbdPx6YUXndORLLIzO/ixM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(211936372134217)(153496737603132); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231254)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:DM3PR15MB1083; BCL:0; PCL:0; RULEID:; SRVR:DM3PR15MB1083; X-Forefront-PRVS: 070092A9D3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39860400002)(376002)(346002)(39380400002)(396003)(189003)(199004)(316002)(53416004)(25786009)(50466002)(68736007)(2906002)(6116002)(48376002)(6916009)(6666003)(1076002)(86362001)(50226002)(6512007)(53936002)(7736002)(305945005)(8936002)(81166006)(81156014)(4326008)(47776003)(97736004)(6506007)(46003)(11346002)(105586002)(486006)(446003)(2616005)(476003)(106356001)(52396003)(52116002)(69596002)(5660300001)(8676002)(16526019)(186003)(386003)(54906003)(76176011)(16586007)(478600001)(36756003)(6486002)(51416003)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM3PR15MB1083; H:castle.thefacebook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR15MB1083; 23:4XJLxaQUnL3iHE9jmD6G3SaU5BFDIdk3IRASDFHLG?= =?us-ascii?Q?wY0J92lqLSOzlaFZeva/cJLaNRSbRyBFbpa/DgF0S3zcVXjdYy8+s8lkraLq?= =?us-ascii?Q?jWdsC5KfbBp6j1cUTuwlbrboYuNtIqU2HPArTruC5XU6L4POB8/eThMGSjk5?= =?us-ascii?Q?XE53fW2OWDyvXh8BkwcKeR8XgF8VXdwA0QxZafHCZOAKWOwd/s/xrh0Qyzqw?= =?us-ascii?Q?WNeEObmAW/XDyqDiOYexCW5gG44zoEj6gfHop8R5uNI1mAde0I1QlpfQHVDx?= =?us-ascii?Q?beYA1Ye7MjloIafC1U22+3SgGgWSEHl9ySRyWNjo9DWB0+Xh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ADZAJBM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM3PR15MB1083; 7:TIjjib6auMQvN6HP7DKCtLM21aFOBwr09jeE3fTi46FoDWxqzcpKlpuCbQuEPia2MMJs9brhwK+T739hVDaVD3eQa0FDE4SDVYl56cuWvAraJQYjFmfj0lq4K6szXl8WxZ7WFOVqo+V+lYyErOqjd8nXrDyNQeNm3urrvC+7ldmbtkWUDN4inYAjRXaBRZDM5SBXfd1w2aPU5z2LorwrOxtJ4fBMUFo3Wxyzaz21bSSaOtTu9XjISk6qy+CK3dw9; 20:i8Sq9h9DSbKbcJtn056n+Wcy2981YDwJcIpZUEwWkXuBkAQdQloj3i3eB+RILTYDdyGfNKoumu9fgGSG28tZNeL9q+zGNmABq09Ptw9VND4l/5yparNa/3SXXktMR8FRfi8+N47IruI0rTgddYXVFEwpNndM9i+KDOusH9guyLg= X-MS-Office365-Filtering-Correlation-Id: 7cbb3ca5-4cf9-43a5-fa80-08d5cfc468e1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2018 17:54:41.4956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cbb3ca5-4cf9-43a5-fa80-08d5cfc468e1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1083 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-11_08:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Shakeel reported a crash in mem_cgroup_protected(), which can be triggered by memcg reclaim if the legacy cgroup v1 use_hierarchy=0 mode is used: [ 226.060572] BUG: unable to handle kernel NULL pointer dereference at 0000000000000120 [ 226.068310] PGD 8000001ff55da067 P4D 8000001ff55da067 PUD 1fdc7df067 PMD 0 [ 226.075191] Oops: 0000 [#4] SMP PTI [ 226.078637] CPU: 0 PID: 15581 Comm: bash Tainted: G D 4.17.0-smp-clean #5 [ 226.086635] Hardware name: ... [ 226.094546] RIP: 0010:mem_cgroup_protected+0x54/0x130 [ 226.099533] Code: 4c 8b 8e 00 01 00 00 4c 8b 86 08 01 00 00 48 8d 8a 08 ff ff ff 48 85 d2 ba 00 00 00 00 48 0f 44 ca 48 39 c8 0f 84 cf 00 00 00 <48> 8b 81 20 01 00 00 4d 89 ca 4c 39 c8 4c 0f 46 d0 4d 85 d2 74 05 [ 226.118194] RSP: 0000:ffffabe64dfafa58 EFLAGS: 00010286 [ 226.123358] RAX: ffff9fb6ff03d000 RBX: ffff9fb6f5b1b000 RCX: 0000000000000000 [ 226.130406] RDX: 0000000000000000 RSI: ffff9fb6f5b1b000 RDI: ffff9fb6f5b1b000 [ 226.137454] RBP: ffffabe64dfafb08 R08: 0000000000000000 R09: 0000000000000000 [ 226.144503] R10: 0000000000000000 R11: 000000000000c800 R12: ffffabe64dfafb88 [ 226.151551] R13: ffff9fb6f5b1b000 R14: ffffabe64dfafb88 R15: ffff9fb77fffe000 [ 226.158602] FS: 00007fed1f8ac700(0000) GS:ffff9fb6ff400000(0000) knlGS:0000000000000000 [ 226.166594] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 226.172270] CR2: 0000000000000120 CR3: 0000001fdcf86003 CR4: 00000000001606f0 [ 226.179317] Call Trace: [ 226.181732] ? shrink_node+0x194/0x510 [ 226.185435] do_try_to_free_pages+0xfd/0x390 [ 226.189653] try_to_free_mem_cgroup_pages+0x123/0x210 [ 226.194643] try_charge+0x19e/0x700 [ 226.198088] mem_cgroup_try_charge+0x10b/0x1a0 [ 226.202478] wp_page_copy+0x134/0x5b0 [ 226.206094] do_wp_page+0x90/0x460 [ 226.209453] __handle_mm_fault+0x8e3/0xf30 [ 226.213498] handle_mm_fault+0xfe/0x220 [ 226.217285] __do_page_fault+0x262/0x500 [ 226.221158] do_page_fault+0x28/0xd0 [ 226.224689] ? page_fault+0x8/0x30 [ 226.228048] page_fault+0x1e/0x30 [ 226.231323] RIP: 0033:0x485b72 The problem happens because parent_mem_cgroup() returns a NULL pointer, which is dereferenced later without a check. As cgroup v1 has no memory guarantee support, let's make mem_cgroup_protected() immediately return MEMCG_PROT_NONE, if the given cgroup has no parent (non-hierarchical mode is used). Reported-by: Shakeel Butt Tested-by: Shakeel Butt Signed-off-by: Roman Gushchin Acked-by: Johannes Weiner Acked-by: Michal Hocko Cc: Andrew Morton Fixes: bf8d5d52ffe8 ("memcg: introduce memory.min") --- mm/memcontrol.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c1e64d60ed02..5a3873e9d657 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5480,6 +5480,10 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, elow = memcg->memory.low; parent = parent_mem_cgroup(memcg); + /* No parent means a non-hierarchical mode on v1 memcg */ + if (!parent) + return MEMCG_PROT_NONE; + if (parent == root) goto exit;