xfs: fix missing error check in xfs_rtfree_range
PATCH 1/1 xfs: fix missing error check in xfs_rtfree_range
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!).
--- fs/xfs/xfs_rtalloc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/xfs/xfs_rtalloc.c +2 -0
@@ -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.
Signature · 6 lines
1.6.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Dave Chinner
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.
Quoted 1 line
Signed-off-by Dave Chinner <[email protected]>
Quoted 8 lines
fs/xfs/xfs_rtalloc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/xfs/xfs_rtalloc.c +0
-0
fs/xfs/xfs_rtalloc.c xfs_rtfree_range( · line 1524
Quoted 8 lines
fs/xfs/xfs_rtalloc.c +2
-0@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs