mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Jiale Yao <yaojiale02@163.com>
Cc: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Heming Zhao <heming.zhao@suse.com>,
	Tristan Ye <tristan.ye@oracle.com>,
	ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ocfs2: validate non-coherent freefrag bitmap inode
Date: Tue, 20 Oct 2026 15:43:21 +0800	[thread overview]
Message-ID: <f4f403bf-efc4-4629-bb7b-2c3b2cc35303@linux.alibaba.com> (raw)
In-Reply-To: <20261018114118.927071-1-yaojiale02@163.com>



On 10/18/26 7:41 PM, Jiale Yao wrote:
> The non-coherent freefrag ioctl path reads the global bitmap inode
> directly and trusts its chain list. A malformed cl_next_free_rec value
> can therefore index beyond cl_recs while scanning chains.
> 

Could you  provide the detailed bug report?

> Validate the inode block before consuming its bitmap and chain metadata.
> 
> Fixes: d24a10b9f8ed ("Ocfs2: Add a new code 'OCFS2_INFO_FREEFRAG' for o2info ioctl.")
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
>  fs/ocfs2/ioctl.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
> index cbe59d231666..8383f900c847 100644
> --- a/fs/ocfs2/ioctl.c
> +++ b/fs/ocfs2/ioctl.c
> @@ -575,6 +575,12 @@ static int ocfs2_info_freefrag_scan_bitmap(struct ocfs2_super *osb,
>  			mlog_errno(status);
>  			goto bail;
>  		}
> +
> +		status = ocfs2_validate_inode_block(osb->sb, bh);
> +		if (status < 0) {
> +			mlog_errno(status);
> +			goto bail;
> +		}

ocfs2_validate_inode_block() only validates cl_next_free_rec when
on-disk dinode has OCFS2_CHAIN_FL set. So a crafted global bitmap block
without that flag still lets the freefrag chain walk index past cl_recs[]
and read out of bounds from the buffer_head.

Thanks,
Joseph

>  	}
>  
>  	gb_dinode = (struct ocfs2_dinode *)bh->b_data;


  reply	other threads:[~2026-10-20  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 11:41 Jiale Yao
2026-10-20  7:43 ` Joseph Qi [this message]
2026-10-20  7:57   ` jiale yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4f403bf-efc4-4629-bb7b-2c3b2cc35303@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=heming.zhao@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=tristan.ye@oracle.com \
    --cc=yaojiale02@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®