patch-2.1.48 linux/fs/ext2/ialloc.c

Next file: linux/fs/ext2/namei.c
Previous file: linux/fs/dquot.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.47/linux/fs/ext2/ialloc.c linux/fs/ext2/ialloc.c
@@ -290,8 +290,18 @@
 	struct ext2_group_desc * tmp;
 	struct ext2_super_block * es;
 
-	if (!dir || !(inode = get_empty_inode ()))
+	/* Cannot create files in a deleted directory */
+	if (!dir || !dir->i_nlink) {
+		*err = -EPERM;
 		return NULL;
+	}
+
+	inode = get_empty_inode ();
+	if (!inode) {
+		*err = -ENOMEM;
+		return NULL;
+	}
+
 	sb = dir->i_sb;
 	inode->i_sb = sb;
 	inode->i_flags = sb->s_flags;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov