public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Syncing up libxfs to kernel source
@ 2008-07-23  7:52 Barry Naujok
  2008-07-23 22:43 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Naujok @ 2008-07-23  7:52 UTC (permalink / raw)
  To: xfs@oss.sgi.com

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Syncing up libxfs to kernel source
  2008-07-23  7:52 Syncing up libxfs to kernel source Barry Naujok
@ 2008-07-23 22:43 ` Dave Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2008-07-23 22:43 UTC (permalink / raw)
  To: Barry Naujok; +Cc: xfs@oss.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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-23 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23  7:52 Syncing up libxfs to kernel source Barry Naujok
2008-07-23 22:43 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox