From patchwork Thu Jan 16 02:50:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuye X-Patchwork-Id: 13941170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3BE1C02180 for ; Thu, 16 Jan 2025 02:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D5026B0082; Wed, 15 Jan 2025 21:50:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 685106B0085; Wed, 15 Jan 2025 21:50:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54C436B0088; Wed, 15 Jan 2025 21:50:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3AA786B0082 for ; Wed, 15 Jan 2025 21:50:23 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E94B81A06A4 for ; Thu, 16 Jan 2025 02:50:22 +0000 (UTC) X-FDA: 83011786284.19.70D82DD Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by imf01.hostedemail.com (Postfix) with ESMTP id C74B640006 for ; Thu, 16 Jan 2025 02:50:19 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of liuye@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=liuye@kylinos.cn ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736995821; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=Np7TW0Z10vZNHU6WA5I2GbuNt0+o3YIgjF3fH9okD4M=; b=vNgDmkmGAXKfLN2Gf9IYVuoDRU4Cn40GI0FjLvo9WNoYoIAZDZZwF/UFdKHv3leq378ZHi si8AAJNr+04Cz4qeMCv644f+JeKB/AE+GQHzlDDmNEbxvijcku+bBEF8mcAGIbLZJWDr7o A7ky2B0OMwF2t+Lz8P7a9NzHjZjfPcI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736995821; a=rsa-sha256; cv=none; b=0TIPMywB9TnhPzrK/k2fM6m8QLtpGZkm26zL6F8gWUXNGu2g++FsKrCvGXa4NgREqCL0xS 7YF7RaerFqVJL7ub3JkUzo/Jku12PgXRgeVEB5zm6Gy9hScr5OxnMnj9bEeAUClm0eeXcN g+AM2lYsoYJLZ4rb6hoXtn4SET4oClo= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf01.hostedemail.com: domain of liuye@kylinos.cn designates 124.126.103.232 as permitted sender) smtp.mailfrom=liuye@kylinos.cn X-UUID: 9a1b603ed3b411efa216b1d71e6e1362-20250116 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM, HR_SJ_PHRASE HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT, HR_TO_NO_NAME IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_EXISTED, SN_EXISTED SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS, CIE_BAD, CIE_GOOD_SPF GTI_FG_BS, GTI_RG_INFO, GTI_C_BU, AMN_T1, AMN_GOOD AMN_C_TI, AMN_C_BU, ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:786c00f3-2c70-44b2-b5ea-bc536367cd3e,IP:10, URL:0,TC:0,Content:0,EDM:-25,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,AC TION:release,TS:-30 X-CID-INFO: VERSION:1.1.45,REQID:786c00f3-2c70-44b2-b5ea-bc536367cd3e,IP:10,UR L:0,TC:0,Content:0,EDM:-25,RT:0,SF:-15,FILE:0,BULK:0,RULE:EDM_GE969F26,ACT ION:release,TS:-30 X-CID-META: VersionHash:6493067,CLOUDID:ba0b9d03d97d1eb138b6b75429b31a7b,BulkI D:250116105012IRW59DJB,BulkQuantity:0,Recheck:0,SF:17|19|24|38|44|66|78|10 2,TC:nil,Content:0|50,EDM:1,IP:-2,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BE C:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI X-UUID: 9a1b603ed3b411efa216b1d71e6e1362-20250116 X-User: liuye@kylinos.cn Received: from localhost.localdomain [(223.70.160.239)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1734857039; Thu, 16 Jan 2025 10:50:10 +0800 From: Liu Ye To: akpm@linux-foundation.org, Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com Cc: jannh@google.com, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Liu Ye Subject: [PATCH] mm/vma: Add VM_WARN_ON for commit_merge Date: Thu, 16 Jan 2025 10:50:05 +0800 Message-Id: <20250116025005.55846-1-liuye@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Stat-Signature: sa58k4xgfidh6t1mctiw4mu8m6xwye9c X-Rspam-User: X-Rspamd-Queue-Id: C74B640006 X-Rspamd-Server: rspam03 X-HE-Tag: 1736995819-864001 X-HE-Meta: U2FsdGVkX19bvQpPTIcqEb84nnVSaMF08O81Wt2V2SnuscvuBGfU8Cmang0+wUbBB5uOWA7MEE9eX+1V05x7oOawbl+b2gjr5OXbtMsaK2/5PdIoQBrY95Xzq43u2lDt9uzF2xjg19dolg1vykpcbZzk/xlXSV4qDW4C5Jjrula2Pf98ysiA/Txa74WuEcLNo64pu+QqEd4gBSNUhd7Pq1f0gjN9+Akcm91JJ2i2nP4S81pkw1zcwgWDtCjc3w+TtItKyeKCw2phGrnpntoec4lvwLdWWoDSKZ5/aTaQFCM8m8RLAPOaPW0EZwU5QkkPVXt28sv47K4IEWGGmNDXQIIEO5k5QXuwTamstBH1BASTbCCu3tuYLb0gCu0TMuQnsLivA5K4Oy+TPLVD40t1lE9f8+8PLcKwd3cHnh8Vy3Uuut5Bz5IUtHWovIV+7hsajKIpMzfIgmj4JTQAS4imYcbnkpSX6b/xZQjb2RYKj7KK6dTN0G7NbQQkQjT521Z+2tfCu+wp4rgn607jbW4G1lccbr62zsHO1Sex1XMDGScq8uBhUnAGF/j+ZIWwK9td+zg2MFTQCuVR3qxrf2qqu25vjXyTzSkx5OWRYuS1I7HvdiLa3yeR/vfS8WlrK79oIi/qqWptoDXckv+1JnkFV4t2YwKFlyUG4BcHuH4eW4iWKww3p+bioCvgABzAnYyjLjmAWwOUeF+lWShw9iE+jkohsrxAknoMMYW1NCzLWAX8ZB/rUHXnHbHM6fLcu+tEdBnPkq0cb4qbBhz6fY1aPS58NrpeEeT3C0kXhtiEM9ySbBc46zY6R7V9X98bNK2vDkt5FqsE7hLBguqCnEMKiMiWYkn/vBkq/ytiaVQmc40lk7yfzqsi7SCrm77VHUuuJa3LkDJvqgtCoNFvkmQvi5sRArl/MD5ImSY4exMR7rRzaHAJbP/zsKdmeWggpNDLOw8PmkfiEACsNUayamF /gFnsrT5 z8EEpdxb7sCAJsLw6krWpP3BfLcDmUdDNjxiHXhNjRwz540UztW2Wq5wFEntfjGEuateAowVCssiLuuI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000099, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add VM_WARN_ON to prevent 'adjust' from accessing NULL pointers when 'adjust' is NULL and 'expanded' is false or 'adj_start' is not zero. Signed-off-by: Liu Ye --- mm/vma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/vma.c b/mm/vma.c index 31c9c6f51c9f..36b5ac675504 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -641,6 +641,7 @@ static int commit_merge(struct vma_merge_struct *vmg, init_multi_vma_prep(&vp, vmg->vma, adjust, remove, remove2); + VM_WARN_ON(!adjust && (!expanded || adj_start)); VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma && vp.anon_vma != adjust->anon_vma);