* [PATCH] xfs: fix missing error check in xfs_rtfree_range
@ 2010-01-14 8:44 Dave Chinner
2010-01-14 18:54 ` Alex Elder
0 siblings, 1 reply; 2+ messages in thread
From: Dave Chinner @ 2010-01-14 8:44 UTC (permalink / raw)
To: xfs
When xfs_rtfind_forw() returns an error, the block is returned
uninitialised. xfs_rtfree_range() is not checking the error return,
so could be using an uninitialised block number for modifying bitmap
summary info.
The problem was found by gcc when compiling the *userspace* libxfs
code - it is an copy of the kernel code with the exact same bug.
gcc gives an uninitialised variable warning on the userspace code
but not on the kernel code. You gotta love the consistency (Mmmm,
slightly chewy today!).
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
fs/xfs/xfs_rtalloc.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 9e15a11..6be05f7 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1517,6 +1517,8 @@ xfs_rtfree_range(
*/
error = xfs_rtfind_forw(mp, tp, end, mp->m_sb.sb_rextents - 1,
&postblock);
+ if (error)
+ return error;
/*
* If there are blocks not being freed at the front of the
* old extent, add summary data for them to be allocated.
--
1.6.5
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] xfs: fix missing error check in xfs_rtfree_range
2010-01-14 8:44 [PATCH] xfs: fix missing error check in xfs_rtfree_range Dave Chinner
@ 2010-01-14 18:54 ` Alex Elder
0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2010-01-14 18:54 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
Dave Chinner wrote:
> When xfs_rtfind_forw() returns an error, the block is returned
> uninitialised. xfs_rtfree_range() is not checking the error return,
> so could be using an uninitialised block number for modifying bitmap
> summary info.
>
> The problem was found by gcc when compiling the *userspace* libxfs
> code - it is an copy of the kernel code with the exact same bug.
> gcc gives an uninitialised variable warning on the userspace code
> but not on the kernel code. You gotta love the consistency (Mmmm,
> slightly chewy today!).
Looks good. I'll send this for 2.6.33-rc4.
> Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
> fs/xfs/xfs_rtalloc.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index 9e15a11..6be05f7 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -1517,6 +1517,8 @@ xfs_rtfree_range(
> */
> error = xfs_rtfind_forw(mp, tp, end, mp->m_sb.sb_rextents - 1,
> &postblock);
> + if (error)
> + return error;
> /*
> * If there are blocks not being freed at the front of the
> * old extent, add summary data for them to be allocated.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-14 18:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14 8:44 [PATCH] xfs: fix missing error check in xfs_rtfree_range Dave Chinner
2010-01-14 18:54 ` Alex Elder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox