Re: [PATCH] ocfs2: validate quota file block count in ocfs2_local_read_info()
Joseph Qi <[email protected]> Wed, 1 Jul 2026 17:08:46 +0800
| Newsgroups | dev.linux.lists.ocfs2-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 6/25/26 4:44 PM, Dmitry Antipov wrote: > In 'ocfs2_local_read_info()', assume that number of blocks allocated > for local quota file should not exceed the limit based on claimed > number of chunks, and refuse an attempt to enable quota otherwise. > > Reported-by: Sam Sun <[email protected]> > Signed-off-by: Dmitry Antipov <[email protected]> > --- > fs/ocfs2/quota_local.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c > index f55810c59b1b..33a9b5b449c8 100644 > --- a/fs/ocfs2/quota_local.c > +++ b/fs/ocfs2/quota_local.c > @@ -733,6 +733,13 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) > oinfo->dqi_blocks = le32_to_cpu(ldinfo->dqi_blocks); > oinfo->dqi_libh = bh; > > + if (oinfo->dqi_blocks > oinfo->dqi_chunks * ol_chunk_blocks(sb)) { This will reject valid on-disk layouts. See ol_quota_chunk_block(). BTW, could we move the geometry bound check into a dedicated info-block validator? Thanks, Joseph > + mlog(ML_ERROR, "unexpectedly large local quota " > + "file block count %u\n", oinfo->dqi_blocks); > + status = -EFSCORRUPTED; > + goto out_err; > + } > + > /* We crashed when using local quota file? */ > if (!(oinfo->dqi_flags & OLQF_CLEAN)) { > rec = OCFS2_SB(sb)->quota_rec;