Skip to contentSkip to conversation

fsck.f2fs: init quota_file before re-create quota file

PATCH In review Sheng Yong 2 participants 2 messages Jul 12, 2018

lore
Share & tools
lore

Sheng Yong

author
#0 lore raw

PATCH 1/1 fsck.f2fs: init quota_file before re-create quota file

quota_handle->qh_qf->filesize' is not initialized by quota_create_file(). It contains random value, which is updated to quota file's i_size in quota_file_close(). Since quota file is re-created, filesize' can be initialized as 0.

---
 fsck/quotaio.c | 1 +
 1 file changed, 1 insertion(+)
fsck/quotaio.c +1 -0
index afadf56..26f8a71 100644
@@ -160,6 +160,7 @@ errcode_t quota_file_create(struct f2fs_sb_info *sbi, struct quota_handle *h,
 	f2fs_ino_t qf_inum = sb->qf_ino[qtype];
 	errcode_t err = 0;
 
+	memset(&h->qh_qf, 0, sizeof(h->qh_qf));
 	h->qh_qf.sbi = sbi;
 	h->qh_qf.ino = qf_inum;
 	h->write = quota_write_nomount;
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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Sheng Yong

quota_handle->qh_qf->filesize' is not initialized by quota_create_file(). It contains random value, which is updated to quota file's i_size in quota_file_close(). Since quota file is re-created, filesize' can be initialized as 0.

Thanks,

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