Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1995752pxa; Mon, 24 Aug 2020 01:52:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLT0JbthsM7IXKizYaTrKTpr2/txctvfVuMOt+qjoGTVXkimql3n0oflb4yiDFoXGbzB8D X-Received: by 2002:a17:906:b108:: with SMTP id u8mr4782393ejy.249.1598259148624; Mon, 24 Aug 2020 01:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598259148; cv=none; d=google.com; s=arc-20160816; b=xqiFLdX1GPMtD7g5PjNdl0ffHbCO0fHOxbny1Lt0cv3zviawOtbImXUQkO3fekrxP5 71sJ9OvrLiOKy64OIsKoI7cYTKhqIWwMjzEAp5sutudRB2H9Oeg6FaynpJcZPu5g0DiJ qzda9buc44JGH8LnMjy0iuf73tbvxwqctWcYNj4nzOIeMvcAfVVZYdPdDJ8vOEL+vFaz eYbRl2I3kxAl1ruZuq27fBWoB8kaVhuD7lXS3vjbksOQuWMJX2QeiJFJ5p8ed979jfyn 7o1epybnUmytZanS0DC0kGAkbkxhtnPxq+mYuxjzvq9VMrvP7MTkzp/dt/czye4S3sHf EcKw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ecWNZqjdMKNCp27l9zVNF+64v3gyqWzDLHyXNoibk7I=; b=q03KtazMBBct/rvOE+q1AZ17hWglFvesv3X8tMkY1E0Fca+7J0+J7KU3QTixPHcD24 bVimnX9vuicaWnCP4Mq9cLXkc2CKbtFEvYia4y8Y+V4Jo35i7MOdZJ8+GLpDbIFucauv VlGdODNcBrhEYUzj6PwpIuz4QmxONgfWDqczS2XKDDZeTgFYMQnCGt8hnFqQTlmUI/hz yKD/tjbsTODEsOV6bB/CK2sYpzhFW3Gi3IchDoRsMJTeZEHCilxnord3BqXSURvNHM76 YNpcU4vSqBpJ/8v+pRGWj84+DVRocz5EkGJMIWDc1YeOaIE1fl6ZJsIcd4df0KZGCmxF +1jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tkUFqxXD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si3811530ejg.347.2020.08.24.01.52.05; Mon, 24 Aug 2020 01:52:28 -0700 (PDT) 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=default header.b=tkUFqxXD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729951AbgHXIvg (ORCPT + 99 others); Mon, 24 Aug 2020 04:51:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:56476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728460AbgHXIv0 (ORCPT ); Mon, 24 Aug 2020 04:51:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A227D2072D; Mon, 24 Aug 2020 08:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598259086; bh=CNhFNAUvh1EmrgeFYiDEaS9LJYFkJitLo/xMDYLQ+vY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tkUFqxXD41PeIBty5Tm1JRYAjyAxjLpYryjB2mLM82QOXkHfDm9XzZe+JMFc7fipW w5dJqIb0ck9Zgav74cuGb8pT9hp9qVbqmEzLBeOHTIAWd0cGXDA/8j+t9llv0Y2Skc 9MyFnULSDrWwW+rUSJkXGyvixSEff2jrIiloq540= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "zhangyi (F)" , Ritesh Harjani , stable@kernel.org, Theodore Tso Subject: [PATCH 4.9 15/39] jbd2: add the missing unlock_buffer() in the error path of jbd2_write_superblock() Date: Mon, 24 Aug 2020 10:31:14 +0200 Message-Id: <20200824082349.270439673@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824082348.445866152@linuxfoundation.org> References: <20200824082348.445866152@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zhangyi (F) commit ef3f5830b859604eda8723c26d90ab23edc027a4 upstream. 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) Reviewed-by: Ritesh Harjani Cc: stable@kernel.org Link: https://lore.kernel.org/r/20200620061948.2049579-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1340,8 +1340,10 @@ static int jbd2_write_superblock(journal 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))