diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2007-07-16 02:39:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:41 -0400 |
commit | c9c64155f5a81b4b41e98f9fb9c464a565c1bf72 (patch) | |
tree | 23a163b5a1b8e0ed441db5cf722116d9caa0c956 /fs/udf | |
parent | d62141414a55ff3f1410b27db2a95224446e77a4 (diff) |
UDF: check for allocated memory for data of new inodes
Add checking for granted memory for inode data at the moment of its
creation.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Jan Kara <jack@ucw.cz>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/ialloc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 8206983f2ebf..10f3188738af 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -50,7 +50,7 @@ void udf_free_inode(struct inode * inode) | |||
50 | else | 50 | else |
51 | UDF_SB_LVIDIU(sb)->numFiles = | 51 | UDF_SB_LVIDIU(sb)->numFiles = |
52 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1); | 52 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1); |
53 | 53 | ||
54 | mark_buffer_dirty(sbi->s_lvidbh); | 54 | mark_buffer_dirty(sbi->s_lvidbh); |
55 | } | 55 | } |
56 | mutex_unlock(&sbi->s_alloc_mutex); | 56 | mutex_unlock(&sbi->s_alloc_mutex); |
@@ -136,6 +136,13 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
136 | UDF_I_EFE(inode) = 0; | 136 | UDF_I_EFE(inode) = 0; |
137 | UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); | 137 | UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); |
138 | } | 138 | } |
139 | if (!UDF_I_DATA(inode)) | ||
140 | { | ||
141 | iput(inode); | ||
142 | *err = -ENOMEM; | ||
143 | mutex_unlock(&sbi->s_alloc_mutex); | ||
144 | return NULL; | ||
145 | } | ||
139 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) | 146 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) |
140 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; | 147 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; |
141 | else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 148 | else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |