diff options
-rw-r--r-- | fs/ext3/inode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index b176d4253544..6e4f8a529fbc 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -676,6 +676,10 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode, | |||
676 | * parent to disk. | 676 | * parent to disk. |
677 | */ | 677 | */ |
678 | bh = sb_getblk(inode->i_sb, new_blocks[n-1]); | 678 | bh = sb_getblk(inode->i_sb, new_blocks[n-1]); |
679 | if (unlikely(!bh)) { | ||
680 | err = -ENOMEM; | ||
681 | goto failed; | ||
682 | } | ||
679 | branch[n].bh = bh; | 683 | branch[n].bh = bh; |
680 | lock_buffer(bh); | 684 | lock_buffer(bh); |
681 | BUFFER_TRACE(bh, "call get_create_access"); | 685 | BUFFER_TRACE(bh, "call get_create_access"); |
@@ -717,7 +721,7 @@ failed: | |||
717 | BUFFER_TRACE(branch[i].bh, "call journal_forget"); | 721 | BUFFER_TRACE(branch[i].bh, "call journal_forget"); |
718 | ext3_journal_forget(handle, branch[i].bh); | 722 | ext3_journal_forget(handle, branch[i].bh); |
719 | } | 723 | } |
720 | for (i = 0; i <indirect_blks; i++) | 724 | for (i = 0; i < indirect_blks; i++) |
721 | ext3_free_blocks(handle, inode, new_blocks[i], 1); | 725 | ext3_free_blocks(handle, inode, new_blocks[i], 1); |
722 | 726 | ||
723 | ext3_free_blocks(handle, inode, new_blocks[i], num); | 727 | ext3_free_blocks(handle, inode, new_blocks[i], num); |