diff mbox series

[2/2] xfs: rtbitmap scrubber should check inode size

Message ID 159353170715.2864648.7793153787081876108.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs: strengthen online checking | expand

Commit Message

Darrick J. Wong June 30, 2020, 3:41 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Make sure the rtbitmap is large enough to store the entire bitmap.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/scrub/rtbitmap.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Allison Henderson June 30, 2020, 9:05 p.m. UTC | #1
On 6/30/20 8:41 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Make sure the rtbitmap is large enough to store the entire bitmap.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good
Reviewed-by: Allison Collins <allison.henderson@oracle.com>

> ---
>   fs/xfs/scrub/rtbitmap.c |    7 +++++++
>   1 file changed, 7 insertions(+)
> 
> 
> diff --git a/fs/xfs/scrub/rtbitmap.c b/fs/xfs/scrub/rtbitmap.c
> index c777c98c50c3..76e4ffe0315b 100644
> --- a/fs/xfs/scrub/rtbitmap.c
> +++ b/fs/xfs/scrub/rtbitmap.c
> @@ -101,6 +101,13 @@ xchk_rtbitmap(
>   {
>   	int			error;
>   
> +	/* Is the size of the rtbitmap correct? */
> +	if (sc->mp->m_rbmip->i_d.di_size !=
> +	    XFS_FSB_TO_B(sc->mp, sc->mp->m_sb.sb_rbmblocks)) {
> +		xchk_ino_set_corrupt(sc, sc->mp->m_rbmip->i_ino);
> +		return 0;
> +	}
> +
>   	/* Invoke the fork scrubber. */
>   	error = xchk_metadata_inode_forks(sc);
>   	if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/rtbitmap.c b/fs/xfs/scrub/rtbitmap.c
index c777c98c50c3..76e4ffe0315b 100644
--- a/fs/xfs/scrub/rtbitmap.c
+++ b/fs/xfs/scrub/rtbitmap.c
@@ -101,6 +101,13 @@  xchk_rtbitmap(
 {
 	int			error;
 
+	/* Is the size of the rtbitmap correct? */
+	if (sc->mp->m_rbmip->i_d.di_size !=
+	    XFS_FSB_TO_B(sc->mp, sc->mp->m_sb.sb_rbmblocks)) {
+		xchk_ino_set_corrupt(sc, sc->mp->m_rbmip->i_ino);
+		return 0;
+	}
+
 	/* Invoke the fork scrubber. */
 	error = xchk_metadata_inode_forks(sc);
 	if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))