From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 11/14] hfsplus: protect readdir against removals from open_dir_list Date: Fri, 1 Oct 2010 09:27:15 +0200 Message-ID: <20101001072715.GK27055@lst.de> References: <20101001072500.GA26972@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: viro@zeniv.linux.org.uk, zippel@linux-m68k.org Return-path: Received: from verein.lst.de ([213.95.11.210]:48994 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917Ab0JAH1c (ORCPT ); Fri, 1 Oct 2010 03:27:32 -0400 Content-Disposition: inline In-Reply-To: <20101001072500.GA26972@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: We already have i_mutex for readdir and the namespace operations that add entries to open_dir_list, the only thing that was missing was the removal in hfsplus_dir_release. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/hfsplus/dir.c =================================================================== --- linux-2.6.orig/fs/hfsplus/dir.c 2010-09-30 12:19:50.314782662 +0200 +++ linux-2.6/fs/hfsplus/dir.c 2010-09-30 12:37:09.436782661 +0200 @@ -231,7 +231,9 @@ static int hfsplus_dir_release(struct in { struct hfsplus_readdir_data *rd = file->private_data; if (rd) { + mutex_lock(&inode->i_mutex); list_del(&rd->list); + mutex_unlock(&inode->i_mutex); kfree(rd); } return 0;