Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2988820imu; Mon, 19 Nov 2018 09:02:57 -0800 (PST) X-Google-Smtp-Source: AJdET5c9+hWUxk3ncLH1dj/DqQ0j+eSzV/gr+4ldw3MqrDftiksAB0s2kn9Pi6l+EzId/iIGCzfS X-Received: by 2002:a17:902:9a91:: with SMTP id w17-v6mr22295728plp.274.1542646977739; Mon, 19 Nov 2018 09:02:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646977; cv=none; d=google.com; s=arc-20160816; b=HiuGAhSVe/qJXdJPE5FqRiJhDZA8wgsH8oKzsbfmADVIMeavRvpVTh2yIXkIrr728p /bgSutcmyOxx2SmcW0uC8hL5v6yXvvyt0xyMrlyR/ppgu57erXh3MYpeNYpPE3eshtNE 3Xl//IaZKIsLq/eAtIEmTC/rRzt54M1tmXhSdbLjvuPm+Dv3oFYrZKyfWZTSriKbB9p/ 2bqdhl0TkPjukDk8VUpLjqLQMgYkOsMo4y4DDkf/ri2oVsRrHd6UsED7j5QvNaWtbEIK CpjxTOAe/o2jGhvG6o8nLy3RSDWU4Tf9iNuDIcQiH0adWBaFYrhXdq7S3LG+y8jisaRz 01rg== 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=fJXWDblL/gpdmwRg5Wc044x7TidDwGqn82BDNVWZ07g=; b=d/27suNq9+JnGXVH+XSOPj6OLNH+GjSpx73/3CJgtVkVY+F2b9oKOvSlHeY2IPV2PB ngx8cwoABOJK0fIV+5AtlWe1mYBlLxXPslV71Mw2XmPfv6tWWbfuqxoILleG0IvzUL4u lrtNTeWxqyqIjTrGhG7JGgf+BDjuFoBfZFjUOstNCyiWnHFv7nasQnwUZ+kniBwmjzuL Xvfazi7EDKYsVaFjqADnrUMnI6rrWT7xanQdiZubpPHhzAUftNSQQ3Y4LHGgW94Q0Ctm mtWBL9EoL86z8eErfco5C4IThjUwFVUZoU/3q4zp3wJ2vxRzx5NxRUelK9BzS12eWg2w 7C2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aqN8IrXj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19si34051080pgf.573.2018.11.19.09.02.35; Mon, 19 Nov 2018 09:02:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aqN8IrXj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405677AbeKTDZs (ORCPT + 99 others); Mon, 19 Nov 2018 22:25:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:39086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404909AbeKTDZr (ORCPT ); Mon, 19 Nov 2018 22:25:47 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C2B3D22353; Mon, 19 Nov 2018 17:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646891; bh=0cPqpbne3ogzzuKa0MHeibYGHRIr11p1wE0KEJXiJ8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqN8IrXjo1ZdF3anoIBjj2W5IuX/54wWF+bMIxGRUZS/2n8O2iqzTzZef1VhNxNtU mO7g2GNMgMOQtC7jv31Qe3eLy1o45ewCUXITodlvLRQH2ljErcYCr+hq8eLpV/y0t/ 9ztb3RVprLLmxtGXVctgbP58urtFvdPpxXn7pJfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changwei Ge , Changkuo Shi , Andrew Morton , Mark Fasheh , Joel Becker , Junxiao Bi , Joseph Qi , Linus Torvalds Subject: [PATCH 4.4 130/160] ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry Date: Mon, 19 Nov 2018 17:29:29 +0100 Message-Id: <20181119162642.951287467@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162630.031306128@linuxfoundation.org> References: <20181119162630.031306128@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Changwei Ge commit 29aa30167a0a2e6045a0d6d2e89d8168132333d5 upstream. Somehow, file system metadata was corrupted, which causes ocfs2_check_dir_entry() to fail in function ocfs2_dir_foreach_blk_el(). According to the original design intention, if above happens we should skip the problematic block and continue to retrieve dir entry. But there is obviouse misuse of brelse around related code. After failure of ocfs2_check_dir_entry(), current code just moves to next position and uses the problematic buffer head again and again during which the problematic buffer head is released for multiple times. I suppose, this a serious issue which is long-lived in ocfs2. This may cause other file systems which is also used in a the same host insane. So we should also consider about bakcporting this patch into linux -stable. Link: http://lkml.kernel.org/r/HK2PR06MB045211675B43EED794E597B6D56E0@HK2PR06MB0452.apcprd06.prod.outlook.com Signed-off-by: Changwei Ge Suggested-by: Changkuo Shi Reviewed-by: Andrew Morton Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Joseph Qi Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1896,8 +1896,7 @@ static int ocfs2_dir_foreach_blk_el(stru /* On error, skip the f_pos to the next block. */ ctx->pos = (ctx->pos | (sb->s_blocksize - 1)) + 1; - brelse(bh); - continue; + break; } if (le64_to_cpu(de->inode)) { unsigned char d_type = DT_UNKNOWN;