Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5458504pxu; Tue, 22 Dec 2020 18:41:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJy55TpbwI0+KKgLdvR7hnBORLN6pnOLPEZ0YltcLRjUOpcAPxNiYZ4Dp2T9IOnCyGfA/s/F X-Received: by 2002:a17:906:8051:: with SMTP id x17mr21624403ejw.430.1608691279604; Tue, 22 Dec 2020 18:41:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608691279; cv=none; d=google.com; s=arc-20160816; b=lQ5dS0oD1u6hWvsWPISRUyLzw0mcZGOePimnvRK8yeqShNUv4q+Y+YYmROH0K7bwAw +SF5FfAzHiuszbTDWPc+4j94JStPQNtoe9022A5gPI5qmmAWAf/dZHVO9j9zjQxqej6J YKZ7pRSeMrr2EuuRVN2sDmsziJr6ljjpRGSofb+a0nwargoM4pmeS8ODFll3oudQjmxs kXsfajh5edwPDRWcRtaqi/cZNKuq3f/uAfsJR1SBXQhH481OMydIHroGMqZyDpgYNmPN IB5xk0nLgmwNJbFR7X+XavavY+WQz4rmV+Kn4zLWYzRMV4Mz8k5YP+kMr0VvmeTueD0/ bLUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IF5LfmZvYmtKb8XIKhCyw+4iJ0GLjxTS7JgAujjcyRY=; b=JFhipyCuXZNYAIf3qUs1ZZ3M9UOWP8JRU02tiAnlMMo94qHpGc2CQLpfdFUi/KOKPe Q0TZire9eEibYr9TUeEYSlUCWjzCOQr2HbULvsnpaQx8euLF2uro5RmYTYIf943/a45d 21xwgHYF/WL9lIRnIA6fCaNFcGXRPEG2jm+XLrnA7+3NXBIYNRJjBZR90sC9yIEer7gY z9tl5hbAiNiASGVCEdYjJwEkElsDYgZXefoVwh++GBm0n9CvFruciFC3yKQ/4Dhyy1hb RftvvcFFjBI+HzdTKzZOcUCDeEUxiEb0B7IX7LIqpYoNMSU8dqHWaBb/GbxQpQPTsUd/ annw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yjz3jnc5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr10si11061622ejc.306.2020.12.22.18.40.57; Tue, 22 Dec 2020 18:41:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yjz3jnc5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730311AbgLWCkc (ORCPT + 99 others); Tue, 22 Dec 2020 21:40:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:51014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730031AbgLWCXg (ORCPT ); Tue, 22 Dec 2020 21:23:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3F74022A83; Wed, 23 Dec 2020 02:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608690198; bh=YrbTY5JpEvTtuhqP3HWPxAhzZ0+tfCCafdmz15WdEwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yjz3jnc5y/Zpw0e6AJWJXUhcaYg72nr2qQ3kX0ANLD0NJmRsyvdTfcqa24cCwHSmU OVED8R5GzTy+9/g2KQUc5919DJyogiMo6Ibe0Gwc3Jyi9bdf5KZhl0kLOM0Zokx9gk gQoKgeE5XNQC3NvN2S6fVfNb54uxzQH4vF++aTrZjDZlmxKw8FsXLY1f+fPe/8XsYn gaVtHJ3PrA56Ja0gwL/jcAkDrcfL1DSy7AjPqe+cqsPUeoQwuiT7Smoz8DnFuwdgTm uZjKGQA0JbGCqI8dZzNka0oTy6HJ6FahpgRZu5UHTLy/Esc+QgxWvc8N+M3hIvgw7Z +2wMmW1mGBOwg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dinghao Liu , Dave Kleikamp , Sasha Levin , jfs-discussion@lists.sourceforge.net Subject: [PATCH AUTOSEL 4.14 20/66] jfs: Fix memleak in dbAdjCtl Date: Tue, 22 Dec 2020 21:22:06 -0500 Message-Id: <20201223022253.2793452-20-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201223022253.2793452-1-sashal@kernel.org> References: <20201223022253.2793452-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit 751341b4d7841e2b76e78eec382c2e119165497f ] When dbBackSplit() fails, mp should be released to prevent memleak. It's the same when dbJoin() fails. Signed-off-by: Dinghao Liu Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- fs/jfs/jfs_dmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 2d514c7affc2a..fa14a01950853 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c @@ -2562,15 +2562,19 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level) */ if (oldval == NOFREE) { rc = dbBackSplit((dmtree_t *) dcp, leafno); - if (rc) + if (rc) { + release_metapage(mp); return rc; + } oldval = dcp->stree[ti]; } dbSplit((dmtree_t *) dcp, leafno, dcp->budmin, newval); } else { rc = dbJoin((dmtree_t *) dcp, leafno, newval); - if (rc) + if (rc) { + release_metapage(mp); return rc; + } } /* check if the root of the current dmap control page changed due -- 2.27.0