From patchwork Mon Apr 5 08:53:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 415819 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 3529DC433B4 for ; Mon, 5 Apr 2021 08:58:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1540E6139D for ; Mon, 5 Apr 2021 08:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234102AbhDEI6z (ORCPT ); Mon, 5 Apr 2021 04:58:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:39226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234151AbhDEI6q (ORCPT ); Mon, 5 Apr 2021 04:58:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD624610E8; Mon, 5 Apr 2021 08:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617613120; bh=BvltUfrypYLGIAKnkes7WVV7jvx9zsUX0jRkK3j8FLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfPnb7aEaLyWy3ThSI3ztL+/ghYj7RlNYtS7fLagTpk7EkVm1/c+G1Mcpxl9jMUT5 jojFf//R9lFMPi6MOfwd67+iKICW11vIwNGe8D3kI5dgNw3Udogkw1O6BKkgKmYj/R K7LeqnnqNhGzOBtbohlSI8wejA4wbDUAqbPqbCkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhaolong Zhang , Theodore Tso , Sasha Levin Subject: [PATCH 4.14 03/52] ext4: fix bh ref count on error paths Date: Mon, 5 Apr 2021 10:53:29 +0200 Message-Id: <20210405085022.113961210@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405085021.996963957@linuxfoundation.org> References: <20210405085021.996963957@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhaolong Zhang [ Upstream commit c915fb80eaa6194fa9bd0a4487705cd5b0dda2f1 ] __ext4_journalled_writepage should drop bhs' ref count on error paths Signed-off-by: Zhaolong Zhang Link: https://lore.kernel.org/r/1614678151-70481-1-git-send-email-zhangzl2013@126.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ad6a1282a5cd..9c07c8674b21 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2071,13 +2071,13 @@ static int __ext4_journalled_writepage(struct page *page, if (!ret) ret = err; - if (!ext4_has_inline_data(inode)) - ext4_walk_page_buffers(NULL, page_bufs, 0, len, - NULL, bput_one); ext4_set_inode_state(inode, EXT4_STATE_JDATA); out: unlock_page(page); out_no_pagelock: + if (!inline_data && page_bufs) + ext4_walk_page_buffers(NULL, page_bufs, 0, len, + NULL, bput_one); brelse(inode_bh); return ret; }