Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1061596ybt; Fri, 19 Jun 2020 23:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZMbM/peIeo4GaXRqWytAaT9APaPNFfNyndnRQDdC5/w3bYV3Wtgp7Kt8HRjgydz3tHhsU X-Received: by 2002:a17:906:5006:: with SMTP id s6mr6628996ejj.294.1592634016009; Fri, 19 Jun 2020 23:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592634016; cv=none; d=google.com; s=arc-20160816; b=B9TLkSTTTTLkUpICRmMtLckGguU1LmgL0hOP4NitGeJeH9sCsdFcprTWH1R5dO7Bpw 0G+KCCjzecj93iK/DawqloXUsSTmCui0/jV31N841UtIJQajK64I219Jh6q9TPbcKJKc 33uK7mufKfmyl5C6FV5QWRmFtjeNNDuCSUx8fe+X9QoMOTQ0UBGRcCnI4Flb1CN6+/EM R0R/qQe3ZRw8pBPfGz/ZhZ/+E+eyMPFjyB66DVp8ypMS3pDXgzMwUBZfvbBOa/CDfZFY GhkV6KQ2weCkVPzlB+6sXSX4ut/qSdV9CDjFinF/NkwsbNSaWqVnzTYJFgIDV6seoYdu wU9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=LppL3ChNnfHdNs39nPyCjMysOg8GOOSqAeVOtWFdokw=; b=iyr8KLF7zRmctc+AVI100sSBAZsHb0TRMhCWWMpr5+NQnY481/Ot/xJ9PVeNQ3AJHY tbSWlI4Fw4rzpauWFas7CNikVll1ahcY8F/qEZOgChWpe+Qb/EI1canXxbf/BLhwFtv1 FkH6tFYGdYRYA0g2TjumV8ZZgoGk+ymcNkZCf1g04ZW958hr1riL6lAdU8T+ZkD5xRpC 1h23BtQJTpVl+vbFKP+Mg5vb5liJaE1syirDezfUAegzLK+fOFFZZ54ILD310Qs2g04e wnpdXgrLuR9vnInCj7kcASn/299ItVnB3soSV23Ihm/BBl8K3T8wm/NMuph3Uea/se4T uDRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si5468275edr.276.2020.06.19.23.19.38; Fri, 19 Jun 2020 23:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726019AbgFTGSv (ORCPT + 99 others); Sat, 20 Jun 2020 02:18:51 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:36720 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725290AbgFTGSv (ORCPT ); Sat, 20 Jun 2020 02:18:51 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B7BE37845AC0B27A23F2; Sat, 20 Jun 2020 14:18:48 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sat, 20 Jun 2020 14:18:40 +0800 From: "zhangyi (F)" To: CC: , , , Subject: [PATCH] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock() Date: Sat, 20 Jun 2020 14:19:48 +0800 Message-ID: <20200620061948.2049579-1-yi.zhang@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org jbd2_write_superblock() is under the buffer lock of journal superblock before ending that superblock write, so add a missing unlock_buffer() in in the error path before submitting buffer. Fixes: 742b06b5628f ("jbd2: check superblock mapped prior to committing") Signed-off-by: zhangyi (F) Cc: stable@kernel.org --- fs/jbd2/journal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index a49d0e670ddf..55c4ec4edf96 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1366,8 +1366,10 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags) int ret; /* Buffer got discarded which means block device got invalidated */ - if (!buffer_mapped(bh)) + if (!buffer_mapped(bh)) { + unlock_buffer(bh); return -EIO; + } trace_jbd2_write_superblock(journal, write_flags); if (!(journal->j_flags & JBD2_BARRIER)) -- 2.25.4