summaryrefslogtreecommitdiffstats
path: root/fs/sysv/itree.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--fs/sysv/itree.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 31f66053e..e3d1673b8 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -145,6 +145,10 @@ static int alloc_branch(struct inode *inode,
*/
parent = block_to_cpu(SYSV_SB(inode->i_sb), branch[n-1].key);
bh = sb_getblk(inode->i_sb, parent);
+ if (!bh) {
+ sysv_free_block(inode->i_sb, branch[n].key);
+ break;
+ }
lock_buffer(bh);
memset(bh->b_data, 0, blocksize);
branch[n].bh = bh;