From patchwork Mon Dec 28 12:47:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 354893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFA88C4332E for ; Mon, 28 Dec 2020 14:23:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D624D22B2C for ; Mon, 28 Dec 2020 14:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439204AbgL1OXA (ORCPT ); Mon, 28 Dec 2020 09:23:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:56518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502204AbgL1OVC (ORCPT ); Mon, 28 Dec 2020 09:21:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7041C229C5; Mon, 28 Dec 2020 14:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165222; bh=2M+Vy12sDbH78IIVup0knMteF/n3Wto5NcX6m56tYRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSQUU0ImqqDtrBZ6WOIJQhVxm5HxnpkDqvEP3KPXrRyzWYcoLdMhmA8LdeO+9U1R6 0zB4pI6QE1c1pkIV7swI7ETZHiNuZk8yDN/iJhrFpbuV2sm5dMp8A0FP7zgETWBhbT 4cKuh7X21+7/e3t7sTQf7oeW2w+rnnrX/UNKt3Lc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mike Kravetz , David Hildenbrand , Mina Almasry , David Rientjes , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.10 456/717] hugetlb: fix an error code in hugetlb_reserve_pages() Date: Mon, 28 Dec 2020 13:47:34 +0100 Message-Id: <20201228125042.816491874@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter [ Upstream commit 7fc2513aa237e2ce239ab54d7b04d1d79b317110 ] Preserve the error code from region_add() instead of returning success. Link: https://lkml.kernel.org/r/X9NGZWnZl5/Mt99R@mwanda Fixes: 0db9d74ed884 ("hugetlb: disable region_add file_region coalescing") Signed-off-by: Dan Carpenter Reviewed-by: Mike Kravetz Reviewed-by: David Hildenbrand Cc: Mina Almasry Cc: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d029d938d26d6..3b38ea958e954 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5115,6 +5115,7 @@ int hugetlb_reserve_pages(struct inode *inode, if (unlikely(add < 0)) { hugetlb_acct_memory(h, -gbl_reserve); + ret = add; goto out_put_pages; } else if (unlikely(chg > add)) { /*