From patchwork Thu Jun 23 13:42:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12892766 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 6B445C433EF for ; Thu, 23 Jun 2022 13:32:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D24668E0152; Thu, 23 Jun 2022 09:32:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD2998E0144; Thu, 23 Jun 2022 09:32:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC2B08E0152; Thu, 23 Jun 2022 09:32:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AC6768E0144 for ; Thu, 23 Jun 2022 09:32:39 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 83BF620A2E for ; Thu, 23 Jun 2022 13:32:39 +0000 (UTC) X-FDA: 79609590438.27.E44976A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 666C0C00BE for ; Thu, 23 Jun 2022 13:32:37 +0000 (UTC) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LTLjj53M0zdfwY; Thu, 23 Jun 2022 21:30:49 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 21:32:32 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 21:32:32 +0800 From: Yang Yingliang To: , CC: , , , Subject: [PATCH -next] mm/mmap: fix error return code in do_mas_align_munmap() Date: Thu, 23 Jun 2022 21:42:37 +0800 Message-ID: <20220623134237.2127440-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655991158; a=rsa-sha256; cv=none; b=YY8vYduAv4+cMNHXSfhaOyakeSR3KnV+JIra8zxBzH1UOh1dLslRQ9yy7jz30LIQb2/r2J xDaYN5k1WV+QoGm+wokdL/+anlj6tyEMTwzUcuPR9S6JhCopMI/e/TDbE5+sz5XYtQgq9L XAn9tTVqJE4ABmdo4ysgn9NbSzEKKAA= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of yangyingliang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yangyingliang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655991158; 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: references; bh=bm4eCqHR20hA+C8Vk08fyy698qLMCT6XBokFkuFFEck=; b=bUr+6CzT4PQjJdm1HrC+ufC1XN1BlXk5fhoulgZPATzQuCIea7YWdQ/YKTVzJjqMN9+5Dw rmChJ0mUVi/XSyohcQ0cQTVi9YGs5ZUs65E6hoVjmurCy10vXTzQLBh0+9O3kWTe0ERwnz RvKIBb3+ZZ9KlpfrBQK+oc1Ag+RsyXA= X-Stat-Signature: u5jy76z6aabqoih1pz1coccu4gejjoz4 X-Rspamd-Server: rspam06 Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of yangyingliang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yangyingliang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Queue-Id: 666C0C00BE X-HE-Tag: 1655991157-325888 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: Return error code when munmap_sidetree() fails in do_mas_align_munmap(). Fixes: 81f5504dfb36 ("mm/mmap: change do_mas_align_munmap() to avoid preallocations for sidetree") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Reviewed-by: Liam R. Howlett --- mm/mmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 1bdf56804048..bb978061a790 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2427,7 +2427,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma, mas_set(mas, end); split = mas_prev(mas, 0); - if (munmap_sidetree(split, &mas_detach)) + error = munmap_sidetree(split, &mas_detach); + if (error) goto munmap_sidetree_failed; count++; @@ -2435,7 +2436,8 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma, vma = split; break; } - if (munmap_sidetree(next, &mas_detach)) + error = munmap_sidetree(next, &mas_detach); + if (error) goto munmap_sidetree_failed; count++;