From patchwork Fri Mar 15 14:53:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 228020 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 889972C009C for ; Sat, 16 Mar 2013 01:53:28 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755384Ab3COOxY (ORCPT ); Fri, 15 Mar 2013 10:53:24 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:53638 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755187Ab3COOxW (ORCPT ); Fri, 15 Mar 2013 10:53:22 -0400 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1UGW0S-0004y4-52; Fri, 15 Mar 2013 14:53:16 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id D113F3E7A37; Fri, 15 Mar 2013 10:53:14 -0400 (EDT) Date: Fri, 15 Mar 2013 10:53:14 -0400 From: Theodore Ts'o To: zhuyj Cc: linux-ext4@vger.kernel.org, stable@kernel.org, Willy Tarreau , Paul Gortmaker Subject: Re: Ext4:can not rm directories on 2.6.3x Message-ID: <20130315145314.GB7403@thunk.org> References: <513EDC2B.9020604@gmail.xom> <20130312134229.GJ18595@thunk.org> <513FF163.7080606@gmail.xom> <5142CAE4.3070400@gmail.xom> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5142CAE4.3070400@gmail.xom> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Mar 15, 2013 at 03:16:52PM +0800, zhuyj wrote: > Hi, all > > The two patches can fix this problem. > ext4: Fix fs corruption when make_indexed_dir() fails > ext4: don't dereference null pointer when make_indexed_dir() fails Thanks, Zhujh for figuring this out. Those two patches weren't taggled with cc: stable@vger.kernel.org, but they probably should have been. Since they first appeared in v3.0, the two long-term stable kernels that would benefit with these patches are v3.0.x and v3.2.x. Willy, Paul, would you consider cherry-picking the following commits for your respective stable kernels? git cherry-pick 7ad8e4e6ae2a7c95445ee1715b1714106fb95037 git cherry-pick 6976a6f2acde2b0443cd64f1d08af90630e4ce81 Thanks!! - Ted From 6976a6f2acde2b0443cd64f1d08af90630e4ce81 Mon Sep 17 00:00:00 2001 From: Allison Henderson Date: Sun, 15 May 2011 00:19:41 -0400 Subject: [PATCH] ext4: don't dereference null pointer when make_indexed_dir() fails Fix for a null pointer bug found while running punch hole tests Signed-off-by: Allison Henderson Signed-off-by: "Theodore Ts'o" --- fs/ext4/namei.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 3c7a06e..b754b77 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1413,6 +1413,10 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, frame->at = entries; frame->bh = bh; bh = bh2; + + ext4_handle_dirty_metadata(handle, dir, frame->bh); + ext4_handle_dirty_metadata(handle, dir, bh); + de = do_split(handle,dir, &bh, frame, &hinfo, &retval); if (!de) { /* @@ -1421,8 +1425,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, * with corrupted filesystem. */ ext4_mark_inode_dirty(handle, dir); - ext4_handle_dirty_metadata(handle, dir, frame->bh); - ext4_handle_dirty_metadata(handle, dir, bh); dx_release(frames); return retval; } -- 1.7.12.rc0.22.gcdd159b