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: Xiao Yang X-Patchwork-Id: 1979398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=SNUYNWPo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WxZZd0XKdz1ygF for ; Mon, 2 Sep 2024 00:51:02 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C44B63CC8F9 for ; Sun, 1 Sep 2024 16:50:59 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id A48743CC81C for ; Sun, 1 Sep 2024 16:50:56 +0200 (CEST) Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) by in-6.smtp.seeweb.it (Postfix) with ESMTP id 530D61400B9F for ; Sun, 1 Sep 2024 16:50:50 +0200 (CEST) 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 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-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH] mm/vma: Return the exact errno for vms_gather_munmap_vmas() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: oliver.sang@intel.com, linux-kernel@vger.kernel.org, ltp@lists.linux.it Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 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;