Skip to content

Commit

Permalink
ext2: Check return value from ext2_get_group_desc()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jankara committed Aug 9, 2016
1 parent 81abf25 commit f7a1c35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/ext2/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,

for (i = 0; i < sbi->s_groups_count; i++) {
gdp = ext2_get_group_desc(sb, group, &bh2);
if (!gdp) {
if (++group == sbi->s_groups_count)
group = 0;
continue;
}
brelse(bitmap_bh);
bitmap_bh = read_inode_bitmap(sb, group);
if (!bitmap_bh) {
Expand Down

0 comments on commit f7a1c35

Please sign in to comment.