Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2153137rdb; Tue, 3 Oct 2023 11:52:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsDM1eXrLXZ/tfIEab6ejg9SUfCrxr3IpxmOYCO6aoZN5VrXRdZ8iXyGfRCfZ9+xSM6O1t X-Received: by 2002:a05:6a20:9152:b0:14c:5fa6:e308 with SMTP id x18-20020a056a20915200b0014c5fa6e308mr311568pzc.43.1696359145029; Tue, 03 Oct 2023 11:52:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696359145; cv=pass; d=google.com; s=arc-20160816; b=LMaJqysp66ByX8nFnaxCLXQ/Ew4maH5pDFn4wpapqNlDXCTBbxPbELq0zosNvcKcfi X+cp81GfsLVPLfzXtu6Pkb66mntInvbucH/5bv3yRumgap7A//R9b1i2xuwxhZZmrjwU X0K7eG60wcMCA/P/O4ORW1vMppSIxnXoVl9MOk3HogPbYCFLnoOXCjGO6jgiiLyFtuJC uvkq15dr8natSYLEdI878t83ldd3zFyU149Zktv80kfrw1lbpEE8jqQaF6irZTJnnmLL 6fHGSqb1GuDA1Lm41+FstuiPWOcWUwP16FiE0ccxdIG8JsxfWhrVD0XNUaAJTsAbsLAa DKBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:in-reply-to :content-transfer-encoding:content-disposition:references :mail-followup-to:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=ecCqijyMaKpwOBdMNLilTp8v9jSd37BhpURjlSon3gU=; fh=NdS/BkSbwXl8zqQCMFKxFxBNfZyTlYzdxbAZHF5paTo=; b=TSGxQEKmmGlH86u+iNbXUPTkPFcIrKHWvCwHaqGhFPi7uxYcGQN6Mcgi7znwYU6/iA j2DOvoxKv5DQAX23s/IhGNgrNPijC+KPaDZjtBMRm6dBkQKtff4DApFmuEF8/UpW5N6q 3+1hvNLbk5WIZ7/D8c2UZymCtLWuyXKmCZPZ1zGJ1raD4HeVC95kAnmbz+HhN3Az0jdJ Ao8aZNNBblywBmdzDRoK/TzzIn3TAE10vDjuIEftt+jn18uA1axDf+pVhRf/55CqqD3V 9lc05hUsMorGw9tOgHN0/oFtxOU/zv1UVyZOAfEgI+f1l7h7eFC/rVEFocor4tVDlOKN 3Z5w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=GWbdw8Rf; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cBRqLG10; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id by15-20020a056a00400f00b00690dbcb75d8si1893384pfb.386.2023.10.03.11.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:52:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=GWbdw8Rf; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cBRqLG10; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 299E08132A78; Tue, 3 Oct 2023 11:52:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240739AbjJCSwP (ORCPT + 99 others); Tue, 3 Oct 2023 14:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232086AbjJCSwN (ORCPT ); Tue, 3 Oct 2023 14:52:13 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BC209B; Tue, 3 Oct 2023 11:52:10 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 393I4Nxc004034; Tue, 3 Oct 2023 18:51:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : content-transfer-encoding : in-reply-to : mime-version; s=corp-2023-03-30; bh=ecCqijyMaKpwOBdMNLilTp8v9jSd37BhpURjlSon3gU=; b=GWbdw8RfUWRgG1VobCzPC1KAvMvXUlrXDrVhHeQYpbHP2UXJXsODDdaYYNG5/MRSVNcp KlEi5MzqKcp6uIvrCQ28Z9L7pJIN12e56bhHFDYkOdBS9l28+5zeUIJDJUiFcCwubPIt Db+dZ5mr9m5EZBCIIGRYu80ETPdsllpJ/s4/huqgbWeOBySPdREvbbjYOnlChZPxYdHr 2XWy9U4bhwortbh4cRF0DVqZ8XhR7Gvs516qB9n8VoPDqXMpGkKQuyY90/+8q0AW9jnR 734pSjf4daHpR3g29Ikd4a4XroxUqSVdu+ppFwitzLz4Vl+6v0bbQnuHIoOCQgZFs4W7 jQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3teb9udfqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Oct 2023 18:51:56 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 393ISI4e000352; Tue, 3 Oct 2023 18:51:56 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3tea46dp22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Oct 2023 18:51:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cTIHChKGKYu7HaDtAWZx6v+/GP8dptYTxMBC1mv+mDNBjnOIshNo/JJ06aDTN/sTgER9UXW8DZlSu/0xkIf61ziHoZDp6iZFK8A1iHHuMyPH0DFtMRsNrCppmpAYfD4S5HBspDs7z8zBVlOQx0OG6GPo4C5qJwJb4zIcyoAEfrCo+cxyYMZwwOgNf7oxANzhLc5VX6NDYUPwpDHPiHTJgu0+qjCL0HtlDY3+Um9826NE3U/kgb77lYdWlYrHVoFGhO4/tp9jhUloED/XNw1c4KBDBJ8WpceIEMVoYAkP9mzw3iVotJG3O5sk02ivEhoOjrQIGvBjYxgeN1SHWXiaQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ecCqijyMaKpwOBdMNLilTp8v9jSd37BhpURjlSon3gU=; b=fK5q/LbgjGTgZ0YQp5WXx6mgwuEDUFJWyLSzB4oI8gQ2ARfSO6cj20VyqlLZCQg6v6tTmsESFS8CgiKHEOGZGHrGxrAuN7eVCywaEJ8tdVHEh98QXIHD9LB880HQ8DdQa9kduzJ8OkAx0cOPIk/JJVGJYHbVNUDbTKs2OiK1W0vhjkshr4/cuy43NGB5teOwH3QayD8M+Dg6Dd2nyY5csfBCzizHux881/QvlbNfSlJDg14hdCEgcI7n4/M+0EGZWKpq5KInZJ87/mOUEhexh8cnjPrTCq7H6qSsI6jIpeyvVtlSDTqaMimPUoFs2Yvg1byOPgIrFl+z/CUpz3NEOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ecCqijyMaKpwOBdMNLilTp8v9jSd37BhpURjlSon3gU=; b=cBRqLG10awXRUNi8jFUAkQtdS7iOkx6zUij1l0K4OVeNnu5EtuyHz1WNBDG28JrTcQ+NyK2FqQu1c6nWN1YVeJOv1jUFWDOAuMUWk8Ei3cy5Rkwu4IitimvyizyKEnQtytan+L3xQLgprZbWKDQZ5pxquwSko7iqVmNGRnVXgTI= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by MN2PR10MB4126.namprd10.prod.outlook.com (2603:10b6:208:15f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Tue, 3 Oct 2023 18:51:53 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8979:3e3f:c3e0:8dfa]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8979:3e3f:c3e0:8dfa%4]) with mapi id 15.20.6838.033; Tue, 3 Oct 2023 18:51:53 +0000 Date: Tue, 3 Oct 2023 14:51:49 -0400 From: "Liam R. Howlett" To: Suren Baghdasaryan Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jann Horn , Lorenzo Stoakes , Vlastimil Babka , Matthew Wilcox , stable@vger.kernel.org Subject: Re: [PATCH v3 2/3] mmap: Fix error paths with dup_anon_vma() Message-ID: <20231003185149.brbzyu2ivn25tkeu@revolver> Mail-Followup-To: "Liam R. Howlett" , Suren Baghdasaryan , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jann Horn , Lorenzo Stoakes , Vlastimil Babka , Matthew Wilcox , stable@vger.kernel.org References: <20230929183041.2835469-1-Liam.Howlett@oracle.com> <20230929183041.2835469-3-Liam.Howlett@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: NeoMutt/20220429 X-ClientProxiedBy: YT4PR01CA0305.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10e::13) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|MN2PR10MB4126:EE_ X-MS-Office365-Filtering-Correlation-Id: 97c51b98-5cee-4c96-f152-08dbc441cf32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n51+/43uVEJM/Lp2X61xTZmXWGWmwwo54N4UsZ8l7VGUmCvr424sLl3qbUBPGpuW85HbdD68WEbiLFgdogD/UdzXeCuVk4l7QDT8Svab7g9MMsjD2vG32vM+UaRXOaTCzAmqpwgsP891wnFK9pyEhPcdGGfnbxAosNhJ6UXc4ZmOXmw86rLavAaYpJGNq2c9+ZXM6AzpCulWbNMxXki89rHiqKaSKX6jE7tYDHxXjazFLPnKyfBW8OJOmN5fpRZg5LwiPf9B9Qy3q6MQRBFjHLVuc7/g4lIbD1l4v54UeytGUZlITLnKb2C94UXBCblafUG8Y6z9jBKIh7uudp/FnLDI4C1JfwY5L8rHyQDmDAakSQLc0u9VoRNjuBX1CMDbm4RZL7RPPvI7IZ0o39PyR4KJ4FuEUM7otUNtNFsq8gPK/7LbQQXQrqGaNAQD0fhdjwq/soFIMNebJetgnM6StWBRSbsd+t4S9Gv4PaYE5VdHEypTc/u8Legfk/uN4ZXH/l3mcYuD7oEYrFzZeqvKF0Cee/Ukjyn3ZS+Pxx6ym9pPvVHpj91Apxioz4/5D2f7 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(396003)(39860400002)(346002)(366004)(136003)(376002)(230922051799003)(186009)(64100799003)(451199024)(1800799009)(2906002)(83380400001)(86362001)(33716001)(38100700002)(53546011)(6916009)(316002)(54906003)(66946007)(66476007)(66556008)(6512007)(6506007)(9686003)(1076003)(41300700001)(6486002)(478600001)(6666004)(8676002)(4326008)(5660300002)(26005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OWVPZVVkR0RZYnJ6T2IySlJucDVpTUJBSkd3M3A2RG4wNDF0Q0Y4R2sxQjJj?= =?utf-8?B?ZlltODZtRTJWTnBYV1dOeThMK3g1K1dKVkt1M3I2bE1vWUZ4Z0t4c3kzeE5O?= =?utf-8?B?KzRnVExaalNYeVd3NnU4U1lOdG9zcTQyVWFOaFNWaENRL3A4eTZW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MTmU4RXlz?= =?utf-8?B?dlNOdFZNSVNkUnA4RExCbUlYQVRLZnc5RkovT29BZkVuSi9iK2U2SHIvdVJs?= =?utf-8?B?ZkdYT3hqZU8vQTdxQW1NN3ZrT3phNDA4U0o5NEFxcCtadm9Jc1h4OEZIUjFD?= =?utf-8?B?WTNaeDFJU2tzRC9wOFpYUTZiVnBXdVNmdDJ3L1dGOUxhbjAzUXZ6V0ZNQVVh?= =?utf-8?B?b3FmcVNtOFFyTWJ6bkE1L1BVb0orMGM1cUM1WTA1dUxseGJtaExUYXIzN0I3?= =?utf-8?B?YXVmMS9DbHk1c1hySzM4TU9VWEdlMXVRNlJ6R3ZVa3lCVm13Q1laRENnSTk3?= =?utf-8?B?OXdoQkMrY2hXeUhONzlWdWhIWkMxZWFrZHhuS0lOcWpOWU5XTHlKQW5hdWhC?= =?utf-8?B?UkV2U3J1OGZhWHlyWVcySWV2YWdTMS9VZDhHdWcwdE04Rm5mTEZRVVhKTXhR?= =?utf-8?B?b3dEZFdMUTBlakRvVXVJeWFmQmRVSVRYUGEyNk55cEd4UW56YmJKRkdDdUpz?= =?utf-8?B?T1ZiR1ZrSGpMTUwwaDIvaGJqcjlDN0lJY3MwV2t6MFNhUjlmZFk3WVoxcWVZ?= =?utf-8?B?cjBuTFpkbTVFOTR6SEpsaTVBTmFZR1Z6b3E0MysrOVdLbm13TXM3aWRFM3FY?= =?utf-8?B?eFdBVEw1aVc0MUk2YmRudERZNk9vSGpOb1JiWWpqTWpJeVBseHlLdVJ0UFpr?= =?utf-8?B?ZEE1MGpSWnVGMVhybjV1RE9UVS8zTHNZaXozMzZLcFJVYnRYQT09?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97c51b98-5cee-4c96-f152-08dbc441cf32 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2023 18:51:53.2385 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6/9E1Dl/3nIRwuxSdDD8X8nO4t8FZDFdKs1h0E/uQb5s2xqaAuf8kxsDZHcxOUeuz6uJ6JTmobOJYczdaGY8lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4126 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-03_15,2023-10-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310030140 X-Proofpoint-ORIG-GUID: lsDBAZNNlrOjsc6VEtM05iyFbRFd6lIe X-Proofpoint-GUID: lsDBAZNNlrOjsc6VEtM05iyFbRFd6lIe X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 03 Oct 2023 11:52:21 -0700 (PDT) * Suren Baghdasaryan [231003 12:21]: > On Fri, Sep 29, 2023 at 11:30=E2=80=AFAM Liam R. Howlett > wrote: > > > > When the calling function fails after the dup_anon_vma(), the > > duplication of the anon_vma is not being undone. Add the necessary > > unlink_anon_vma() call to the error paths that are missing them. > > > > This issue showed up during inspection of the error path in vma_merge() > > for an unrelated vma iterator issue. > > > > Users may experience increased memory usage, which may be problematic a= s > > the failure would likely be caused by a low memory situation. > > > > Fixes: d4af56c5c7c6 ("mm: start tracking VMAs with maple tree") > > Cc: stable@vger.kernel.org > > Cc: Jann Horn > > Signed-off-by: Liam R. Howlett > > --- > > mm/mmap.c | 30 ++++++++++++++++++++++-------- > > 1 file changed, 22 insertions(+), 8 deletions(-) > > > > diff --git a/mm/mmap.c b/mm/mmap.c > > index acb7dea49e23..f9f0a5fe4db4 100644 > > --- a/mm/mmap.c > > +++ b/mm/mmap.c > > @@ -583,11 +583,12 @@ static inline void vma_complete(struct vma_prepar= e *vp, > > * dup_anon_vma() - Helper function to duplicate anon_vma > > * @dst: The destination VMA > > * @src: The source VMA > > + * @dup: Pointer to the destination VMA when successful. > > * > > * Returns: 0 on success. > > */ > > static inline int dup_anon_vma(struct vm_area_struct *dst, > > - struct vm_area_struct *src) > > + struct vm_area_struct *src, struct vm_area_struct **dup= ) > > { > > /* > > * Easily overlooked: when mprotect shifts the boundary, make s= ure the > > @@ -595,9 +596,15 @@ static inline int dup_anon_vma(struct vm_area_stru= ct *dst, > > * anon pages imported. > > */ > > if (src->anon_vma && !dst->anon_vma) { > > + int ret; > > + > > vma_assert_write_locked(dst); > > dst->anon_vma =3D src->anon_vma; > > - return anon_vma_clone(dst, src); > > + ret =3D anon_vma_clone(dst, src); > > + if (ret) > > + return ret; > > + > > + *dup =3D dst; > > } > > > > return 0; > > @@ -624,6 +631,7 @@ int vma_expand(struct vma_iterator *vmi, struct vm_= area_struct *vma, > > unsigned long start, unsigned long end, pgoff_t pgoff, > > struct vm_area_struct *next) > > { > > + struct vm_area_struct *anon_dup =3D NULL; > > bool remove_next =3D false; > > struct vma_prepare vp; > > > > @@ -633,7 +641,7 @@ int vma_expand(struct vma_iterator *vmi, struct vm_= area_struct *vma, > > > > remove_next =3D true; > > vma_start_write(next); > > - ret =3D dup_anon_vma(vma, next); > > + ret =3D dup_anon_vma(vma, next, &anon_dup); > > if (ret) > > return ret; >=20 > Shouldn't the above be changed to a "goto nomem" instead of "return ret" = ? >=20 >=20 > > } > > @@ -661,6 +669,8 @@ int vma_expand(struct vma_iterator *vmi, struct vm_= area_struct *vma, > > return 0; > > > > nomem: > > + if (anon_dup) > > + unlink_anon_vmas(anon_dup); > > return -ENOMEM; > > } > > > > @@ -860,6 +870,7 @@ struct vm_area_struct *vma_merge(struct vma_iterato= r *vmi, struct mm_struct *mm, > > { > > struct vm_area_struct *curr, *next, *res; > > struct vm_area_struct *vma, *adjust, *remove, *remove2; > > + struct vm_area_struct *anon_dup =3D NULL; > > struct vma_prepare vp; > > pgoff_t vma_pgoff; > > int err =3D 0; > > @@ -927,18 +938,18 @@ struct vm_area_struct *vma_merge(struct vma_itera= tor *vmi, struct mm_struct *mm, > > vma_start_write(next); > > remove =3D next; /* case 1 */ > > vma_end =3D next->vm_end; > > - err =3D dup_anon_vma(prev, next); > > + err =3D dup_anon_vma(prev, next, &anon_dup); > > if (curr) { /* case 6 */ > > vma_start_write(curr); > > remove =3D curr; > > remove2 =3D next; > > if (!next->anon_vma) > > - err =3D dup_anon_vma(prev, curr); > > + err =3D dup_anon_vma(prev, curr, &anon_= dup); > > } > > } else if (merge_prev) { /* case 2 */ > > if (curr) { > > vma_start_write(curr); > > - err =3D dup_anon_vma(prev, curr); > > + err =3D dup_anon_vma(prev, curr, &anon_dup); > > if (end =3D=3D curr->vm_end) { /* case 7 *= / > > remove =3D curr; > > } else { /* case 5 */ > > @@ -954,7 +965,7 @@ struct vm_area_struct *vma_merge(struct vma_iterato= r *vmi, struct mm_struct *mm, > > vma_end =3D addr; > > adjust =3D next; > > adj_start =3D -(prev->vm_end - addr); > > - err =3D dup_anon_vma(next, prev); > > + err =3D dup_anon_vma(next, prev, &anon_dup); > > } else { > > /* > > * Note that cases 3 and 8 are the ONLY ones wh= ere prev > > @@ -968,7 +979,7 @@ struct vm_area_struct *vma_merge(struct vma_iterato= r *vmi, struct mm_struct *mm, > > vma_pgoff =3D curr->vm_pgoff; > > vma_start_write(curr); > > remove =3D curr; > > - err =3D dup_anon_vma(next, curr); > > + err =3D dup_anon_vma(next, curr, &anon_= dup); > > } > > } > > } > > @@ -1018,6 +1029,9 @@ struct vm_area_struct *vma_merge(struct vma_itera= tor *vmi, struct mm_struct *mm, > > return res; > > > > prealloc_fail: > > + if (anon_dup) > > + unlink_anon_vmas(anon_dup); >=20 > Maybe a stupid question, but why can't we do this unlinking inside > dup_anon_vma() itself when anon_vma_clone() fails? That would > eliminate the need for the out parameter in that function. I suspect > that there is a reason for that which I'm missing. It's too late. This is to undo the link when the preallocation for the maple tree fails. So we had memory to dup the anon vma, but not to put it in the tree. >=20 > > + > > anon_vma_fail: > > vma_iter_set(vmi, addr); > > vma_iter_load(vmi); > > -- > > 2.40.1 > >