All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bill O'Donnell <billodo@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/4] xfs: strengthen rtalloc query range checks
Date: Thu, 31 May 2018 12:16:44 -0500	[thread overview]
Message-ID: <20180531171644.GC25547@redhat.com> (raw)
In-Reply-To: <152778444301.6891.15337114742525069233.stgit@magnolia>

On Thu, May 31, 2018 at 09:34:03AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Strengthen the rtalloc range query checks to make sure that the keys do
> not run off the end of the realtime device inappropriately.  Note that
> the query range functions require units of rt extents, not blocks,
> despite the type name.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

looks fine.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
>  fs/xfs/libxfs/xfs_rtbitmap.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c
> index 7712f282d172..1855182c11ec 100644
> --- a/fs/xfs/libxfs/xfs_rtbitmap.c
> +++ b/fs/xfs/libxfs/xfs_rtbitmap.c
> @@ -1038,8 +1038,11 @@ xfs_rtalloc_query_range(
>  
>  	if (low_rec->ar_startblock > high_rec->ar_startblock)
>  		return -EINVAL;
> -	else if (low_rec->ar_startblock == high_rec->ar_startblock)
> +	if (low_rec->ar_startblock >= mp->m_sb.sb_rextents ||
> +	    low_rec->ar_startblock == high_rec->ar_startblock)
>  		return 0;
> +	if (high_rec->ar_startblock >= mp->m_sb.sb_rextents)
> +		high_rec->ar_startblock = mp->m_sb.sb_rextents - 1;
>  
>  	/* Iterate the bitmap, looking for discrepancies. */
>  	rtstart = low_rec->ar_startblock;
> @@ -1083,7 +1086,7 @@ xfs_rtalloc_query_all(
>  	struct xfs_rtalloc_rec		keys[2];
>  
>  	keys[0].ar_startblock = 0;
> -	keys[1].ar_startblock = tp->t_mountp->m_sb.sb_rblocks;
> +	keys[1].ar_startblock = tp->t_mountp->m_sb.sb_rextents - 1;
>  	keys[0].ar_blockcount = keys[1].ar_blockcount = 0;
>  
>  	return xfs_rtalloc_query_range(tp, &keys[0], &keys[1], fn, priv);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-05-31 17:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 16:33 [PATCH 0/4] xfs-4.18: fix rtdev programming errors Darrick J. Wong
2018-05-31 16:33 ` [PATCH 1/4] xfs: xfs_rtword_t should be unsigned, not signed Darrick J. Wong
2018-05-31 17:09   ` Allison Henderson
2018-05-31 17:14   ` Bill O'Donnell
2018-05-31 16:33 ` [PATCH 2/4] xfs: xfs_rtbuf_get should check the bmapi_read results Darrick J. Wong
2018-05-31 17:09   ` Allison Henderson
2018-05-31 17:15   ` Bill O'Donnell
2018-05-31 16:34 ` [PATCH 3/4] xfs: strengthen rtalloc query range checks Darrick J. Wong
2018-05-31 17:09   ` Allison Henderson
2018-05-31 17:16   ` Bill O'Donnell [this message]
2018-05-31 16:34 ` [PATCH 4/4] xfs: fix xfs_rtalloc_rec units Darrick J. Wong
2018-05-31 17:09   ` Allison Henderson
2018-05-31 17:21   ` Bill O'Donnell

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=20180531171644.GC25547@redhat.com \
    --to=billodo@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.