ext4: fix potential null pointer dereference in ext4_free_inode
PATCH 1/1 ext4: fix potential null pointer dereference in ext4_free_inode
Fix potential null pointer dereferencing problem caused by e43bb4e612 ("ext4: decrement free clusters/inodes counters when block group declared bad")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Namjae Jeon <[email protected]>
Signed-off-by Ashish Sangwan <[email protected]>
--- fs/ext4/ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ialloc.c +1 -1
@@ -338,7 +338,7 @@ out: fatal = err; }else {ext4_error (sb,"bit already cleared for inode %lu" , ino); -if (!EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) { +if (gdp && !EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) {int count; count =ext4_free_inodes_count (sb, gdp); percpu_counter_sub(&sbi->s_freeinodes_counter,
Signature · 1 line
1.7.11-rc0
Quoted 9 lines · Namjae Jeon
Date: Tue, 08 Jul 2014 14:41:22 +0900
From: Namjae Jeon <[email protected]>
To: Theodore Ts'o <[email protected]>
Cc: linux-ext4 <[email protected]>,
'Dan Carpenter' <[email protected]>,
Ashish Sangwan <[email protected]>
Subject: [PATCH] ext4: fix potential null pointer dereference in
ext4_free_inode
Quoted 6 lines
Fix potential null pointer dereferencing problem caused by
e43bb4e612("ext4: decrement free clusters/inodes counters when block group declared bad")Reported-by Dan Carpenter <[email protected]>Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Ashish Sangwan <[email protected]>
Looks good.
Reviewed-by Lukas Czerner <[email protected]>
Quoted 18 lines
--- fs/ext4/ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ext4/ialloc.c +1
-1@@ -338,7 +338,7 @@ out: fatal = err; }else {ext4_error (sb,"bit already cleared for inode %lu" , ino); -if (!EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) { +if (gdp && !EXT4_MB_GRP_IBITMAP_CORRUPT (grp)) {int count; count =ext4_free_inodes_count (sb, gdp); percpu_counter_sub(&sbi->s_freeinodes_counter,