Skip to contentSkip to conversation

f2fs: check total CP pack block count correctly

PATCH In review Sheng Yong 2 participants 5 messages Aug 1, 2018 F2FS file system

lore
Share & tools
lore

Sheng Yong

author
#0 lore raw

PATCH 1/1 f2fs: check total CP pack block count correctly

Fixes 652d19558a347 ('f2fs: fix to do sanity check with block address in main area')
---
 fs/f2fs/checkpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +1 -1
index 3587aa53dc90..c32ee10a1384 100644
@@ -809,7 +809,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi,
 		goto invalid_cp1;
 
 	if (le32_to_cpu(cp_block->cp_pack_total_block_count) >
-					sbi->log_blocks_per_seg) {
+					sbi->blocks_per_seg - 1) {
 		f2fs_msg(sbi->sb, KERN_WARNING,
 			"invalid cp_pack_total_block_count:%u",
 			le32_to_cpu(cp_block->cp_pack_total_block_count));
Signature · 6 lines
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
#1 lore raw

Hi Sheng,

Quoted 3 lines · Sheng Yong
Fixes 652d19558a347 ('f2fs: fix to do sanity check with block address in main area')

That's my bad, and thanks for the fix.

Do you mind merge this into buggy patch, since the patch has not been upstreamed yet.

Thanks,

Quoted 10 lines
---
 fs/f2fs/checkpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +0 -0
index 3587aa53dc90..c32ee10a1384 100644

fs/f2fs/checkpoint.c static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, · line 815

Quoted 8 lines
fs/f2fs/checkpoint.c +1 -1
@@ -809,7 +809,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi,
 		goto invalid_cp1;
 
 	if (le32_to_cpu(cp_block->cp_pack_total_block_count) >
-					sbi->log_blocks_per_seg) {
+					sbi->blocks_per_seg - 1) {
 		f2fs_msg(sbi->sb, KERN_WARNING,
 			"invalid cp_pack_total_block_count:%u",
 			le32_to_cpu(cp_block->cp_pack_total_block_count));

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#2 lore raw
Quoted 11 lines · Chao Yu

Hi Sheng,

Quoted 3 lines · Sheng Yong
Fixes 652d19558a347 ('f2fs: fix to do sanity check with block address in main area')

That's my bad, and thanks for the fix.

Do you mind merge this into buggy patch, since the patch has not been upstreamed yet.

No, of course not :)

Thanks,

Quoted 14 lines

Thanks,

Quoted 11 lines
---
  fs/f2fs/checkpoint.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +0 -0
index 3587aa53dc90..c32ee10a1384 100644
@@ -809,7 +809,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi,
  		goto invalid_cp1;
 
Quoted 11 lines

fs/f2fs/checkpoint.c static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, · line 815

Quoted 7 lines
fs/f2fs/checkpoint.c +1 -1
  	if (le32_to_cpu(cp_block->cp_pack_total_block_count) >
-					sbi->log_blocks_per_seg) {
+					sbi->blocks_per_seg - 1) {
  		f2fs_msg(sbi->sb, KERN_WARNING,
  			"invalid cp_pack_total_block_count:%u",
  			le32_to_cpu(cp_block->cp_pack_total_block_count));

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#3 lore raw
Quoted 33 lines · Sheng Yong
Quoted 11 lines · Chao Yu

Hi Sheng,

Quoted 3 lines · Sheng Yong
Fixes 652d19558a347 ('f2fs: fix to do sanity check with block address in main area')

That's my bad, and thanks for the fix.

Do you mind merge this into buggy patch, since the patch has not been upstreamed yet.

No, of course not :)

Thanks,

Quoted 14 lines

Thanks,

Quoted 11 lines
---
  fs/f2fs/checkpoint.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +0 -0
index 3587aa53dc90..c32ee10a1384 100644
@@ -809,7 +809,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi,
  		goto invalid_cp1;
 
Quoted 3 lines
Quoted 3 lines

fs/f2fs/checkpoint.c static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, · line 812

Quoted 3 lines
fs/f2fs/checkpoint.c +1 -1
  	if (le32_to_cpu(cp_block->cp_pack_total_block_count) >
-					sbi->log_blocks_per_seg) {
+					sbi->blocks_per_seg - 1) {

actually, cp_pack_total_block_count can be sbi->blocks_per_seg?

Thanks,

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
  		f2fs_msg(sbi->sb, KERN_WARNING,
  			"invalid cp_pack_total_block_count:%u",
  			le32_to_cpu(cp_block->cp_pack_total_block_count));
Quoted 6 lines
Quoted 2 lines

.

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#4 lore raw
Quoted 34 lines · Chao Yu
Quoted 33 lines · Sheng Yong
Quoted 11 lines · Chao Yu

Hi Sheng,

Quoted 3 lines · Sheng Yong
Fixes 652d19558a347 ('f2fs: fix to do sanity check with block address in main area')

That's my bad, and thanks for the fix.

Do you mind merge this into buggy patch, since the patch has not been upstreamed yet.

No, of course not :)

Thanks,

Quoted 14 lines

Thanks,

Quoted 11 lines
---
   fs/f2fs/checkpoint.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/checkpoint.c +0 -0
index 3587aa53dc90..c32ee10a1384 100644
@@ -809,7 +809,7 @@ static struct page *validate_checkpoint(struct f2fs_sb_info *sbi,
   		goto invalid_cp1;
 
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

fs/f2fs/checkpoint.c static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, · line 812

Quoted 3 lines
fs/f2fs/checkpoint.c +1 -1
   	if (le32_to_cpu(cp_block->cp_pack_total_block_count) >
-					sbi->log_blocks_per_seg) {
+					sbi->blocks_per_seg - 1) {

actually, cp_pack_total_block_count can be sbi->blocks_per_seg?

Oh, right, it can be sbi->blocks_per_seg :)

Thanks

Quoted 12 lines

Thanks,

Quoted 10 lines
Quoted 8 lines

fs/f2fs/checkpoint.c static struct page *validate_checkpoint(struct f2fs_sb_info *sbi, · line 815

Quoted 4 lines
fs/f2fs/checkpoint.c +0 -0
   		f2fs_msg(sbi->sb, KERN_WARNING,
   			"invalid cp_pack_total_block_count:%u",
   			le32_to_cpu(cp_block->cp_pack_total_block_count));

.

Quoted 6 lines
Quoted 2 lines

.

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot