From 4490e9a08367c7af617358de5b85ae7ab5198278 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Sat, 8 Oct 2016 18:25:13 +0200 Subject: ext2fs: Fix block allocation. * ext2fs/xattr.c (ext2_set_xattr): Check returned block number before mapping it. --- ext2fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext2fs/xattr.c') diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c index 41e8c89c..c5771fe0 100644 --- a/ext2fs/xattr.c +++ b/ext2fs/xattr.c @@ -704,7 +704,6 @@ ext2_set_xattr (struct node *np, const char *name, const char *value, goal = sblock->s_first_data_block + np->dn->info.i_block_group * EXT2_BLOCKS_PER_GROUP (sblock); blkno = ext2_new_block (goal, 0, 0, 0); - block = disk_cache_block_ref (blkno); if (blkno == 0) { @@ -712,6 +711,7 @@ ext2_set_xattr (struct node *np, const char *name, const char *value, goto cleanup; } + block = disk_cache_block_ref (blkno); memset (block, 0, block_size); header = EXT2_XATTR_HEADER (block); -- cgit v1.2.3