public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Barry Naujok <bnaujok@sgi.com>
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: Syncing up libxfs to kernel source
Date: Thu, 24 Jul 2008 08:43:59 +1000	[thread overview]
Message-ID: <20080723224359.GN6761@disturbed> (raw)
In-Reply-To: <op.ueqitmgv3jf8g2@pc-bnaujok.melbourne.sgi.com>

On Wed, Jul 23, 2008 at 05:52:24PM +1000, Barry Naujok wrote:
> This one is mainly for Dave...
>
> In xfs_alloc_read_agf() in xfs_alloc.c, the current user-space version
> checks:
>
> agf_ok = ...
> 	be32_to_cpu(agf->agf_btreeblks) <= be32_to_cpu(agf->agf_length) &&
> 	...
>
> but the kernel version doesn't.
>
> Is this an oversight with the lazy-counter code in the kernel, remove from
> user-space or leave them different?

Oversight in the kernel code. Patch below.

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com


Check that the number of AGF btree blocks is within a sane bound
when reading the AGF. Noticed by Barry Naujok.

Signed-off-by: Dave Chinner <david@fromorbit.com>
---
 fs/xfs/xfs_alloc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 1956f83..a85bf20 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -2185,6 +2185,7 @@ xfs_alloc_read_agf(
 		be32_to_cpu(agf->agf_magicnum) == XFS_AGF_MAGIC &&
 		XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum)) &&
 		be32_to_cpu(agf->agf_freeblks) <= be32_to_cpu(agf->agf_length) &&
+		be32_to_cpu(agf->agf_btreeblks) <= be32_to_cpu(agf->agf_length) &&
 		be32_to_cpu(agf->agf_flfirst) < XFS_AGFL_SIZE(mp) &&
 		be32_to_cpu(agf->agf_fllast) < XFS_AGFL_SIZE(mp) &&
 		be32_to_cpu(agf->agf_flcount) <= XFS_AGFL_SIZE(mp);

      reply	other threads:[~2008-07-23 22:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  7:52 Syncing up libxfs to kernel source Barry Naujok
2008-07-23 22:43 ` Dave Chinner [this message]

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=20080723224359.GN6761@disturbed \
    --to=david@fromorbit.com \
    --cc=bnaujok@sgi.com \
    --cc=xfs@oss.sgi.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