aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/ialloc.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-08-09 04:07:52 -0400
committerJan Kara <jack@suse.cz>2016-08-09 04:12:28 -0400
commitf7a1c358e51c21b80336413fb824e1a82df648b9 (patch)
treef0c30066ab4ac93472b3d24324900f95022bb966 /fs/ext2/ialloc.c
parent81abf2525827b29839a78fd55ab0699f033c41a5 (diff)
ext2: Check return value from ext2_get_group_desc()
ext2_get_group_desc() can return NULL if there is some error. This usually means there is some programming error in the ext2 driver itself but let's be defensive and handle that case. Coverity-id: 115628 Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2/ialloc.c')
-rw-r--r--fs/ext2/ialloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index efe5fb21c533..04e73a99902b 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -465,6 +465,11 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
465 465
466 for (i = 0; i < sbi->s_groups_count; i++) { 466 for (i = 0; i < sbi->s_groups_count; i++) {
467 gdp = ext2_get_group_desc(sb, group, &bh2); 467 gdp = ext2_get_group_desc(sb, group, &bh2);
468 if (!gdp) {
469 if (++group == sbi->s_groups_count)
470 group = 0;
471 continue;
472 }
468 brelse(bitmap_bh); 473 brelse(bitmap_bh);
469 bitmap_bh = read_inode_bitmap(sb, group); 474 bitmap_bh = read_inode_bitmap(sb, group);
470 if (!bitmap_bh) { 475 if (!bitmap_bh) {