Commit 220ca310a53200b4bfbc7c4c6e365eea284ec44f
Committed by
Lachlan McIlroy
1 parent
8f330f5149
Exists in
master
and in
7 other branches
[XFS] XFS: Check for valid transaction headers in recovery
When we are about to add a new item to a transaction in recovery, we need to check that it is valid first. Currently we just assert that header magic number matches, but in production systems that is not present and we add a corrupted transaction to the list to be processed. This results in a kernel oops later when processing the corrupted transaction. Instead, if we detect a corrupted transaction, abort recovery and leave the user to clean up the mess that has occurred. SGI-PV: 988145 SGI-Modid: xfs-linux-melb:xfs-kern:32356a Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Tim Shimmin <tes@sgi.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff
fs/xfs/xfs_log_recover.c
... | ... | @@ -1419,7 +1419,13 @@ |
1419 | 1419 | return 0; |
1420 | 1420 | item = trans->r_itemq; |
1421 | 1421 | if (item == NULL) { |
1422 | - ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC); | |
1422 | + /* we need to catch log corruptions here */ | |
1423 | + if (*(uint *)dp != XFS_TRANS_HEADER_MAGIC) { | |
1424 | + xlog_warn("XFS: xlog_recover_add_to_trans: " | |
1425 | + "bad header magic number"); | |
1426 | + ASSERT(0); | |
1427 | + return XFS_ERROR(EIO); | |
1428 | + } | |
1423 | 1429 | if (len == sizeof(xfs_trans_header_t)) |
1424 | 1430 | xlog_recover_add_item(&trans->r_itemq); |
1425 | 1431 | memcpy(&trans->r_theader, dp, len); /* d, s, l */ |