From patchwork Thu Sep 28 17:16:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13403337 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 33F86E732FD for ; Thu, 28 Sep 2023 17:16:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E8618D0023; Thu, 28 Sep 2023 13:16:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26F4A8D00C0; Thu, 28 Sep 2023 13:16:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 073F08D0023; Thu, 28 Sep 2023 13:16:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DE8DF8D00C0 for ; Thu, 28 Sep 2023 13:16:55 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9BBD11403E8 for ; Thu, 28 Sep 2023 17:16:55 +0000 (UTC) X-FDA: 81286661190.30.219FD13 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf30.hostedemail.com (Postfix) with ESMTP id 1548C80023 for ; Thu, 28 Sep 2023 17:16:51 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="xZ6QuJf/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VwAY40M8; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf30.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695921412; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ReaEeKMqxObRXDD9d8gCwYRWB+q/MHS998BcLo0Q20I=; b=jxyU35Wq67JvNU4AbJ7TF2ZapZImUozawLp5XbTxEn19nWdpI8GV3Nz180RWB7BP/Ojpyg JD3lNlg0fS/j8S7yzhg3Jamr6ZHLhVpfNdehsYu1TfiZP2NpzQbJeQx5hlwP4oyYzswDG6 tpGdmEC8Qjhbas9OwU1IWko2ttPhUGM= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b="xZ6QuJf/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VwAY40M8; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf30.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1695921412; a=rsa-sha256; cv=pass; b=iWolsouZFy9Gthnv1QJRseVHXP8KsY8Fubbu4F0BMXoXd+RdL+C8w7uBuosMtu9Qw+686r X1ryAkwEzd41XAdwokP9Qlh5FoL4ZX6n08gdzUgvtUYb22OUgyZz3dvdOGKpp2dzPMmP3v e8kssNP+f8Oi4vnCfYd1L/ClyPmh920= 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 38SGi5CX027549; Thu, 28 Sep 2023 17:16:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ReaEeKMqxObRXDD9d8gCwYRWB+q/MHS998BcLo0Q20I=; b=xZ6QuJf/eOpAeSmg/mxzVkeq4IyUvushF/1POVAoz563JkauPfEFV4HsQTl+K9mTqDIw y7ijCrGCm8rn4oxb2ZkzRqg9/LOh2DQKLiScwYALoN/RXOeepZk1tGR7DbTqh8khSYcd 4u/7GNEbiRDvtCWvYPPX5sICIgwEaUA2MMkvjG2AOTKBDz/H3ONUwDCqpEBgFitbeFEq 0+tg9S4V57nGBAScUXIrWo8blU/yUOyMfcQ6vpjOpRlLNTaLlmeedzcqGnubDlNgQu4j APyn1iY9gOyak4ysiBhWwdnEzkDoEw9LUH4hvsURZzW8cfDuc6wd/dFtQpFyf+ZhBBSz nQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9qmun283-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 17:16:46 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38SH1oEA013823; Thu, 28 Sep 2023 17:16:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfadq5x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 17:16:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eGmAXNBxBGO0ZNkUW4TIfsIlvHDghJa4x0jUgaGrv7kUobYlzjqOiYpoViFlYXIGsUL57yknHCIMQzjh9JVhWSd7nQcfdarG6O/CxkjdCpsbjpbtRzHi8pRXoNnGLnBAesOx2n1EDf6w4Ttbgut4iOE+BG4RUc+tYx8MPBIMP9zCutN7Qk5XAe7kDlxK7oNLd8IV7IFnnXJ5DCjjE1Pl4dZajLc+4zBzTi9CfouJpvfYNM5EUt35Pcz8h05kGDp6KRFKciy0+YY1BhkIebSXMCt2XpqsMoyMFM9xjpJ/GekZBjIMqS6aTM0VfxEEryyFi0qYom6iz35DXeMYqhc5Ug== 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=ReaEeKMqxObRXDD9d8gCwYRWB+q/MHS998BcLo0Q20I=; b=RC4GWWwWLAGkCtKc8ohgkE3YIIAp6RxkNZutRwy1dLejPCtdBpqKk4EHxUUYm3riMOast5jpeQS5FL6Ism0rcTBZXpveQ7NA7sTEkDKkPdqEwv5PfX9X6zK3AguznfPVWHrz2807jTHMEWDSQOCMwQ0Ild9KiegLIu5WZr9lj1VFc8jFi/aqGYIFtnog3RspWvP7enxulzrjQvrnwbyh6WiYXhIXnevFrFhhC4GdPre2WzJ8gvT3EozvJXHw/H9dntzs5poqKqaXO2QbyETAlArM7rgVW9hlwn/HbrhL4bnei3rdAwhy/Cp00/OWKijQnEsJDvrB7vvDbCyTWTzw5w== 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=ReaEeKMqxObRXDD9d8gCwYRWB+q/MHS998BcLo0Q20I=; b=VwAY40M8i3zKBaFH5YnA3cYxu8oGd0wE5Ajwvpbc7EzrSbHNnHKMARkKJpbWpVzTm/o63d16currkKBE/qMBHjHfdHyLBfrmHZpe0HvAhpXGMu/j9hoEQD7f1XNyt9BdkmYvAhTe0UA6QMxJ0VhtTH3QGa8xlpBn1y2oF6T0fPs= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CH0PR10MB5273.namprd10.prod.outlook.com (2603:10b6:610:db::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Thu, 28 Sep 2023 17:16:43 +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.6813.027; Thu, 28 Sep 2023 17:16:43 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jann Horn , Lorenzo Stoakes , Vlastimil Babka , Suren Baghdasaryan , Matthew Wilcox , stable@vger.kernel.org, "Liam R. Howlett" Subject: [PATCH v2 1/3] mmap: Fix vma_iterator in error path of vma_merge() Date: Thu, 28 Sep 2023 13:16:32 -0400 Message-Id: <20230928171634.2245042-2-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928171634.2245042-1-Liam.Howlett@oracle.com> References: <20230928171634.2245042-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0115.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:85::26) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|CH0PR10MB5273:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a58ee02-0b40-4400-5d04-08dbc046afa1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 95tFYU9md8I87K93ccqrupxRyLfkJ2bRok0EbJAYQ/fqZhJmL3WJL95AtPaoA0b2wFjcmgO5TUrl+obRR0to1tuNep+acvcOQxEMTGJkuQ2Bp2uvQMrxL1MiQNLcrD0POM8d9W97+tvcE/6DPGcu12hPV2nd5JIEZOtjk8p+3/MmUUPKpy415EL1hBhkSDEiEbYmOcrnGyLvhJUQQ+CT85jERPm7H4juE0Wrei/db/DjO3zxMd/xuXgzMSJneY43qR/xOCm0v1pAIAX7rj8aBtWULLkT37BPaPhYjNYC/f25Nb0z7BSIil4y0RYNGy9n4dtIqlk0Shv7e62SKrgGvw1vcZUEJ2Z0fivEyo7nVmpNjAGLjCAPoYLUIQF0FayqDEGEMsz/Rv6AmI36FF+6I2ibd1uku7mZVuKrzI7O8XKp/q6u3ZXMNev5ZPkc8YurxEqS6cLrMKK6FgBlqbvJyMKlz1YWUcvAMTmQwiImFL2OiYvrbA28oT+EkniyaitHLA7eYbPN8sCR2OBd76AWSH6yHxhj73HmZJ0fYqnxvYo= 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)(376002)(396003)(366004)(346002)(39860400002)(136003)(230922051799003)(186009)(64100799003)(451199024)(1800799009)(4326008)(5660300002)(107886003)(66556008)(26005)(83380400001)(1076003)(66476007)(8936002)(54906003)(316002)(478600001)(66946007)(2906002)(2616005)(6916009)(966005)(41300700001)(6486002)(6666004)(8676002)(6512007)(7416002)(6506007)(36756003)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mCR+/hYEbY9gYr27tLfB3+CpQPKTwDCA9PevFZOR7V8NdV/EdXVijYN81il/DhsKcWxxcHKivvTlDZgK4yILlRBg9+r9LOSm9JhO+BH0W8cBLbOrAsL+RaWrRMHbIRDb+zPcz0QN+JeiZyOi3FiQSZMi5vUZMuTQQe2y/4Oy7qYgQfWWdrpn3uy1JtBBuqKGE3/HD0eeMr7ayXSDI/FerosXSqNJs77khYkC/LlmxtUcSyuZ26eTbzm+d0ugp7OHc5UUWpGLz59LM9SGFpbEFjmqyhGKjKrij1CL5mn/ln5fDrx4uuuQFFLVoV8ZUJCeE4cAjJyFBhFiaw/oEJ53HbjHrGRPXv/i+hNgi4+9nB68Yc2M2+fIPmk3KIuAku60nCjDvl7+17M9dHUrzQLY+c7goH8w1K0DjKCnjPYYQbu9FlOR0Vpgab9UTmrboTOtkANJqGdvu5MYOGVeUkcHQusSOPZDpSyqZomsBCCod7ijvnd2AtSJQ/bunJhp6cAz5xDbtTUmnrHKtipOFYDFGyKxHQRz2w5M6v0lp6VYwcvf2IJYOPffzotOR9i7RX9kSbyFgkgOC3X7ExEyJlSUCZXzC60ysc6kK+YiTLSudum42HltQZyiN2T6FSSelb7xjGNhGrYgiMh89JCNJdwcC4lXBWL7PFV+NySel4P08lIBOeyZdTqr60kttrHrUICMurWhhpPQqT4KHYqoexRKrBqBEpsE0cl4IF+a6EJQRZqgJdYd84VA/fA0fKjWGlm5sBU7oapAHgquzWmczaMA91AOWr8iopwo7lR6oLHwVltXJ05tUS9w/+Xt4EXc5H32r6mH3PkO++OZzfSC8Wf7PIMXm+QC/uWKRGbJweFaLeBKHF/PqltUi6OyOl14BThLQRMhUZ1SkY7I5v7g6i93zn/oFyHeYiO6E5x9xY/4d/YSPNBDB9PHW6KLybmWJ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qH5BCQZLpfQ8pCx0hPqel6W4pCYCJORRkwZdXoweh8aOAganbTrC4alv/OA9ncibTIcJzinv/HVxIlkoPEW+Ym6M8FJxHKcvIooqp2RbsfOg8D3qTs0YqBHnl4fxRPIZJTJCBRXXwEjlJARHwYcNogMQNSr6bofegrqfzhd3YBxpSD9zkXUVVp2xmOtVcL5sU2TZu6e8CcD92YLbN0JpC6gvYV7d3TU14fw1ciFVTQDvlm4lNt4GPpKtdR99a+m6tT2nCt8Mu6OC8g3HCbJo/MnCj4F/P6XiP35gH0aWr60lhIJtOTT3kD+0icDIi+P+IgysQ7B1ehiGPSUPvSUuh3qDR19Y5toXeVLJOhFN092ypIop9vXUL03nHh3Epgn6EgNAgFSuulV1uspy3V+ZT80mmGFf7UzAmTh5gVW4ZK6hgjkS6GEkONR8AlEfT+YbOd2EzelGBTYx5leN6R9vvSz697WhQ+XQBR1EUgGDcRf+6Pkfoi0f8/KHX1LYCZFKCYbyk2mbabScqmRJPFl+doZAmiFgmnRnBD19gyQ2/3PaFt9rnZpgYakIja+1ERwqJXlcz04p7q6txzLTR2Q1PVtcOOFFmZ6zlKFyeuQ+JJUNXZcNMKJxo1vPP5Leb7LE+9qtOV4u+i464n6+q X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a58ee02-0b40-4400-5d04-08dbc046afa1 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 17:16:43.0680 (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: UHX7smEAFyAJXyXrJ2zAkthRapqhD06pMMaHKCHYcwN10TnVROJsKQicJdL8MMuQiXL4VNgXNuYSFfNXLFYCQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5273 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-09-28_16,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280150 X-Proofpoint-GUID: _dFsmhfqiwfKCdybeskL1k6Sx6TMN1k5 X-Proofpoint-ORIG-GUID: _dFsmhfqiwfKCdybeskL1k6Sx6TMN1k5 X-Rspamd-Queue-Id: 1548C80023 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: mb4rhsfi6cp6qp817cernzyhsuxe5x1s X-HE-Tag: 1695921411-818011 X-HE-Meta: U2FsdGVkX19dGPL3F0sVV/8hg/hOH+5Xu0s2amPjcthqJjIqrkuUMWriGTeftjGbf7IkVaWVxxwJUvxYfojUOMdDO7tfld3xhS/Sk7xgNOCSqkbnQWSnwWYz6itVKbuvPi2CQXXoGC+MTDdEvOkOW31ng0v67MPF9Xeg+TkHOm1QNS6C1QQfkoQun/AnjabwzZtcaC8AUyqHfWMjRfokCOmafXjjtwHM1HzWCD7L1ai94ONtTgwXCwFEVJywcK8ez2oFW6avMeuwiz0eVt3vmp1ZsSRxO4TIGFWeY82jNrB70Zg36lQyt/3sek0R5ggvLgSBXxp0hYh0z0Pp0q/pPz96vSq0o8Jl/4ova8IBJSQp59CaBLWTEtXx5AD6xCeNDaiCk2z6W1qpax/bvg+LBCizB8uqdVf2+gxq8UMP99do3ywB6XcnWwyVBCmavnLTcNmRQ0WAepP+Zn1ME21y6HYvaW26xdJ/Xb7eC/sE2dKtw4GXabD0X+alQnalOvNU69fL0Pq0ZslfPwST9SpNT78V7LNNtIT2MK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-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When merging of the previous VMA fails after the vma iterator has been moved to the previous entry, the vma iterator must be advanced to ensure the caller takes the correct action on the next vma iterator event. Fix this by adding a vma_next() call to the error path. Users would not notice the effects as it would result in an extra vma_merge() call if the first call ended due to an out-of-memory event. Link: https://lore.kernel.org/linux-mm/CAG48ez12VN1JAOtTNMY+Y2YnsU45yL5giS-Qn=ejtiHpgJAbdQ@mail.gmail.com/ Closes: https://lore.kernel.org/linux-mm/CAG48ez12VN1JAOtTNMY+Y2YnsU45yL5giS-Qn=ejtiHpgJAbdQ@mail.gmail.com/ Fixes: 18b098af2890 ("vma_merge: set vma iterator to correct position.") Cc: stable@vger.kernel.org Cc: Jann Horn Signed-off-by: Liam R. Howlett --- mm/mmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index b56a7f0c9f85..a4eb5a5626bb 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -975,7 +975,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, /* Error in anon_vma clone. */ if (err) - return NULL; + goto anon_vma_fail; if (vma_start < vma->vm_start || vma_end > vma->vm_end) vma_expanded = true; @@ -988,7 +988,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, } if (vma_iter_prealloc(vmi, vma)) - return NULL; + goto prealloc_fail; init_multi_vma_prep(&vp, vma, adjust, remove, remove2); VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma && @@ -1016,6 +1016,12 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm, vma_complete(&vp, vmi, mm); khugepaged_enter_vma(res, vm_flags); return res; + +prealloc_fail: +anon_vma_fail: + if (merge_prev) + vma_next(vmi); + return NULL; } /*