Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9c64155f5a81b4b41e98f9fb9c464a565c1bf72
Commit:     c9c64155f5a81b4b41e98f9fb9c464a565c1bf72
Parent:     d62141414a55ff3f1410b27db2a95224446e77a4
Author:     Cyrill Gorcunov <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:39:43 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:41 2007 -0700

    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 <[EMAIL PROTECTED]>
    Cc: Jan Kara <[EMAIL PROTECTED]>
    Cc: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 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 8206983..10f3188 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -50,7 +50,7 @@ void udf_free_inode(struct inode * inode)
                else
                        UDF_SB_LVIDIU(sb)->numFiles =
                                
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1);
-               
+
                mark_buffer_dirty(sbi->s_lvidbh);
        }
        mutex_unlock(&sbi->s_alloc_mutex);
@@ -136,6 +136,13 @@ struct inode * udf_new_inode (struct inode *dir, int mode, 
int * err)
                UDF_I_EFE(inode) = 0;
                UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - 
sizeof(struct fileEntry), GFP_KERNEL);
        }
+       if (!UDF_I_DATA(inode))
+       {
+               iput(inode);
+               *err = -ENOMEM;
+               mutex_unlock(&sbi->s_alloc_mutex);
+               return NULL;
+       }
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
                UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
        else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to