File tree Expand file tree Collapse file tree 5 files changed +23
-20
lines changed Expand file tree Collapse file tree 5 files changed +23
-20
lines changed Original file line number Diff line number Diff line change @@ -6226,20 +6226,13 @@ xfs_bmap_validate_extent(
6226
6226
struct xfs_bmbt_irec * irec )
6227
6227
{
6228
6228
struct xfs_mount * mp = ip -> i_mount ;
6229
- xfs_fsblock_t endfsb ;
6230
- bool isrt ;
6231
6229
6232
- if (irec -> br_startblock + irec -> br_blockcount <= irec -> br_startblock )
6233
- return __this_address ;
6234
6230
if (irec -> br_startoff + irec -> br_blockcount <= irec -> br_startoff )
6235
6231
return __this_address ;
6236
6232
6237
- isrt = XFS_IS_REALTIME_INODE (ip );
6238
- endfsb = irec -> br_startblock + irec -> br_blockcount - 1 ;
6239
- if (isrt && whichfork == XFS_DATA_FORK ) {
6240
- if (!xfs_verify_rtbno (mp , irec -> br_startblock ))
6241
- return __this_address ;
6242
- if (!xfs_verify_rtbno (mp , endfsb ))
6233
+ if (XFS_IS_REALTIME_INODE (ip ) && whichfork == XFS_DATA_FORK ) {
6234
+ if (!xfs_verify_rtext (mp , irec -> br_startblock ,
6235
+ irec -> br_blockcount ))
6243
6236
return __this_address ;
6244
6237
} else {
6245
6238
if (!xfs_verify_fsbext (mp , irec -> br_startblock ,
Original file line number Diff line number Diff line change @@ -198,6 +198,22 @@ xfs_verify_rtbno(
198
198
return rtbno < mp -> m_sb .sb_rblocks ;
199
199
}
200
200
201
+ /* Verify that a realtime device extent is fully contained inside the volume. */
202
+ bool
203
+ xfs_verify_rtext (
204
+ struct xfs_mount * mp ,
205
+ xfs_rtblock_t rtbno ,
206
+ xfs_rtblock_t len )
207
+ {
208
+ if (rtbno + len <= rtbno )
209
+ return false;
210
+
211
+ if (!xfs_verify_rtbno (mp , rtbno ))
212
+ return false;
213
+
214
+ return xfs_verify_rtbno (mp , rtbno + len - 1 );
215
+ }
216
+
201
217
/* Calculate the range of valid icount values. */
202
218
void
203
219
xfs_icount_range (
Original file line number Diff line number Diff line change @@ -197,6 +197,8 @@ bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino);
197
197
bool xfs_internal_inum (struct xfs_mount * mp , xfs_ino_t ino );
198
198
bool xfs_verify_dir_ino (struct xfs_mount * mp , xfs_ino_t ino );
199
199
bool xfs_verify_rtbno (struct xfs_mount * mp , xfs_rtblock_t rtbno );
200
+ bool xfs_verify_rtext (struct xfs_mount * mp , xfs_rtblock_t rtbno ,
201
+ xfs_rtblock_t len );
200
202
bool xfs_verify_icount (struct xfs_mount * mp , unsigned long long icount );
201
203
bool xfs_verify_dablk (struct xfs_mount * mp , xfs_fileoff_t off );
202
204
void xfs_icount_range (struct xfs_mount * mp , unsigned long long * min ,
Original file line number Diff line number Diff line change @@ -319,7 +319,6 @@ xchk_bmap_iextent(
319
319
struct xfs_bmbt_irec * irec )
320
320
{
321
321
struct xfs_mount * mp = info -> sc -> mp ;
322
- xfs_filblks_t end ;
323
322
int error = 0 ;
324
323
325
324
/*
@@ -349,13 +348,8 @@ xchk_bmap_iextent(
349
348
if (irec -> br_blockcount > MAXEXTLEN )
350
349
xchk_fblock_set_corrupt (info -> sc , info -> whichfork ,
351
350
irec -> br_startoff );
352
- if (irec -> br_startblock + irec -> br_blockcount <= irec -> br_startblock )
353
- xchk_fblock_set_corrupt (info -> sc , info -> whichfork ,
354
- irec -> br_startoff );
355
- end = irec -> br_startblock + irec -> br_blockcount - 1 ;
356
351
if (info -> is_rt &&
357
- (!xfs_verify_rtbno (mp , irec -> br_startblock ) ||
358
- !xfs_verify_rtbno (mp , end )))
352
+ !xfs_verify_rtext (mp , irec -> br_startblock , irec -> br_blockcount ))
359
353
xchk_fblock_set_corrupt (info -> sc , info -> whichfork ,
360
354
irec -> br_startoff );
361
355
if (!info -> is_rt &&
Original file line number Diff line number Diff line change @@ -52,9 +52,7 @@ xchk_rtbitmap_rec(
52
52
startblock = rec -> ar_startext * tp -> t_mountp -> m_sb .sb_rextsize ;
53
53
blockcount = rec -> ar_extcount * tp -> t_mountp -> m_sb .sb_rextsize ;
54
54
55
- if (startblock + blockcount <= startblock ||
56
- !xfs_verify_rtbno (sc -> mp , startblock ) ||
57
- !xfs_verify_rtbno (sc -> mp , startblock + blockcount - 1 ))
55
+ if (!xfs_verify_rtext (sc -> mp , startblock , blockcount ))
58
56
xchk_fblock_set_corrupt (sc , XFS_DATA_FORK , 0 );
59
57
return 0 ;
60
58
}
You can’t perform that action at this time.
0 commit comments