From patchwork Sun Sep 1 14:50:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2o5pmT?= X-Patchwork-Id: 13786511 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 C2A3CC54FC6 for ; Sun, 1 Sep 2024 14:50:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6DB78D004A; Sun, 1 Sep 2024 10:50:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF4B78D0022; Sun, 1 Sep 2024 10:50:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9959F8D004A; Sun, 1 Sep 2024 10:50:48 -0400 (EDT) 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 767388D0022 for ; Sun, 1 Sep 2024 10:50:48 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E1DD581542 for ; Sun, 1 Sep 2024 14:50:47 +0000 (UTC) X-FDA: 82516456134.18.94143BD Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) by imf23.hostedemail.com (Postfix) with ESMTP id D1178140007 for ; Sun, 1 Sep 2024 14:50:44 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=163.com header.s=s110527 header.b=SNUYNWPo; dmarc=pass (policy=none) header.from=163.com; spf=pass (imf23.hostedemail.com: domain of ice_yangxiao@163.com designates 117.135.210.3 as permitted sender) smtp.mailfrom=ice_yangxiao@163.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725202143; 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:dkim-signature; bh=P0iqe6vXWSjMmRXDrMjZrivCVdtRvOplSj137lptWKg=; b=xfEfm9j1e2d0enY6DDn4Bs34clvnQOCUaXmxMHk2yVnAmAxLkXR9/ROUup/CWJ/j1F50jU EodjEbXYktWichWzQT9Z7L/9jP8AghH7sA1jLJH91/lZU8g/QynSOXALTK/gvGNJqIE4Jz haI0/wKA6AJxbNGAk7PX1Yl0A558Wbk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725202143; a=rsa-sha256; cv=none; b=F/6dll0tWTgjVFnvmNAbqKfY1XqEbAc9lCp/bSvBjENal5IDXhykWJ1EVrKbjXzlanYzQ3 FQ9ZRD9WHJgk8OEBuyV/CP6y2N6cK94tRnTlwvrlvrV8wxplyfnqcyeL6lmjVVHCNPRAN/ B/2TbFP/kEMO4ZyboZ8Nrs6kefRLmhk= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=163.com header.s=s110527 header.b=SNUYNWPo; dmarc=pass (policy=none) header.from=163.com; spf=pass (imf23.hostedemail.com: domain of ice_yangxiao@163.com designates 117.135.210.3 as permitted sender) smtp.mailfrom=ice_yangxiao@163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=P0iqe 6vXWSjMmRXDrMjZrivCVdtRvOplSj137lptWKg=; b=SNUYNWPoBCluXsWkItYvY qyMDY62i5MFeU5ycVwREEshcJ/mIcASlz/zJlkojT6P3iqNpTOVkr6b40Ht40fpP ALSOteL47xEQ270K1hBPa5a0s6Ri6aLs39tEOV2OZzN6RbsqPoNd/lZAW4ANSlVf A6p7aldKFeYk7ORrKkJyO0= Received: from fedora40-vm.. (unknown [160.86.227.247]) by gzga-smtp-mta-g3-1 (Coremail) with SMTP id _____wD3_0Q0f9Rm6pl+BA--.39198S2; Sun, 01 Sep 2024 22:50:31 +0800 (CST) From: Xiao Yang To: Liam.Howlett@Oracle.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, ltp@lists.linux.it, andrea.cervesato@suse.com, oliver.sang@intel.com, Xiao Yang Subject: [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas() Date: Sun, 1 Sep 2024 23:50:25 +0900 Message-ID: <20240901145025.2311-1-ice_yangxiao@163.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-CM-TRANSID: _____wD3_0Q0f9Rm6pl+BA--.39198S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrKr4DtF4fArWUKF47Zw4rGrg_yoWkXwb_Wr W093WkWFsYkFnIyw17Zr9xtrn2grWqvrZ7GFnYkF1aq3ZrC3WrXrWvv3sxArn0qr4qvr9x GwnIkrZayw1j9jkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRknYn5UUUUU== X-Originating-IP: [160.86.227.247] X-CM-SenderInfo: 5lfhs5xdqj5xldr6il2tof0z/1tbiqRxNXmVOClPWIAAAsi X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D1178140007 X-Stat-Signature: cdwk6zzw3ncqqdrd8ebwcjezk4qastew X-Rspam-User: X-HE-Tag: 1725202244-936021 X-HE-Meta: U2FsdGVkX18RNJTrCootGaubE4bl3K7Cc+5V0bXWp1oQg2c9vk4HhvergRTdmDe097xhcVsqwvYtOIH6/BCZTerjV8F071ZVomrtFygDe/O/ZeNGLYOiNrGXZC4u+KGE+mleJafMzRTyEYzsAhCJkufTWq8q0WVB3aLHQD8SuFOSaFnbtFqzSM5ATEy/PLqVwgjY9qInOqZa6lMxoBLYD/8yNO6V6PazUZ4q5N9Oy31YMCGnzU5jESBVcEyVpzU8qyoCf6ZnVRCB2m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v5x+1X76yXHMZS265s3oj9AUCLqCBg6JmL+cOVNmFUhxTYJ4pGBqrRIirOjjk74gNbSycFhU56DxSL7zny0GLyPnJ6i4Iee21SBNR68T00+PQg4iGcEswCZ1Ftpv9q/l5lM6rT/NsHk0/7lsAZWCKnSs/QmXJLwcOlPqD0ckhicgzCGqA= 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: List-Subscribe: List-Unsubscribe: can_modify_vma() in vms_gather_munmap_vmas() returns -EPERM if vma is sealed so don't always return the fixed -ENOMEM on failure. Fixes: c2eb22189bbc ("mm/vma: inline munmap operation in mmap_region()") Fixes: 5887a7ac2383 ("mm/vma: expand mmap_region() munmap call") Signed-off-by: Xiao Yang Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202408312155.fd26a58c-oliver.sang@intel.com --- mm/mmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index c1781f643046..c9a0dc035819 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1386,8 +1386,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr, mt_on_stack(mt_detach); mas_init(&mas_detach, &mt_detach, /* addr = */ 0); /* Prepare to unmap any existing mapping in the area */ - if (vms_gather_munmap_vmas(&vms, &mas_detach)) - return -ENOMEM; + error = vms_gather_munmap_vmas(&vms, &mas_detach); + if (error) + return error; vmg.next = vms.next; vmg.prev = vms.prev;