Browse Source

hfsplus: protect readdir against removals from open_dir_list

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 <hch@tuxera.com>
Christoph Hellwig 14 years ago
parent
commit
89755dcace
1 changed files with 2 additions and 0 deletions
  1. 2 0
      fs/hfsplus/dir.c

+ 2 - 0
fs/hfsplus/dir.c

@@ -231,7 +231,9 @@ static int hfsplus_dir_release(struct inode *inode, struct file *file)
 {
 {
 	struct hfsplus_readdir_data *rd = file->private_data;
 	struct hfsplus_readdir_data *rd = file->private_data;
 	if (rd) {
 	if (rd) {
+		mutex_lock(&inode->i_mutex);
 		list_del(&rd->list);
 		list_del(&rd->list);
+		mutex_unlock(&inode->i_mutex);
 		kfree(rd);
 		kfree(rd);
 	}
 	}
 	return 0;
 	return 0;