public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] prevent panic during log recovery due to bogus operation header length
@ 2007-12-12  7:07 Lachlan McIlroy
  2007-12-14 20:30 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Lachlan McIlroy @ 2007-12-12  7:07 UTC (permalink / raw)
  To: xfs-dev, xfs-oss

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

A problem was reported where a system panicked in log recovery due
to a corrupt log record.  The cause of the corruption is not known
but this change will at least prevent a crash for this specific
scenario.  Log recovery definitely needs some more work in this area.

Lachlan

[-- Attachment #2: xfs_log_recover.diff --]
[-- Type: text/x-patch, Size: 615 bytes --]

--- fs/xfs/xfs_log_recover.c_1.332	2007-12-12 17:14:57.000000000 +1100
+++ fs/xfs/xfs_log_recover.c	2007-12-12 17:15:42.000000000 +1100
@@ -2912,7 +2912,12 @@ xlog_recover_process_data(
 				xlog_recover_new_tid(&rhash[hash], tid,
 					be64_to_cpu(rhead->h_lsn));
 		} else {
-			ASSERT(dp + be32_to_cpu(ohead->oh_len) <= lp);
+			if (dp + be32_to_cpu(ohead->oh_len) > lp) {
+				xlog_warn(
+			"XFS: xlog_recover_process_data: bad length");
+				ASSERT(0);
+				return (XFS_ERROR(EIO));
+			}
 			flags = ohead->oh_flags & ~XLOG_END_TRANS;
 			if (flags & XLOG_WAS_CONT_TRANS)
 				flags &= ~XLOG_CONTINUE_TRANS;

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

* Re: [PATCH] prevent panic during log recovery due to bogus operation header length
  2007-12-12  7:07 [PATCH] prevent panic during log recovery due to bogus operation header length Lachlan McIlroy
@ 2007-12-14 20:30 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2007-12-14 20:30 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: xfs-dev, xfs-oss

On Wed, Dec 12, 2007 at 06:07:47PM +1100, Lachlan McIlroy wrote:
> A problem was reported where a system panicked in log recovery due
> to a corrupt log record.  The cause of the corruption is not known
> but this change will at least prevent a crash for this specific
> scenario.  Log recovery definitely needs some more work in this area.
>
> Lachlan

> --- fs/xfs/xfs_log_recover.c_1.332	2007-12-12 17:14:57.000000000 +1100
> +++ fs/xfs/xfs_log_recover.c	2007-12-12 17:15:42.000000000 +1100
> @@ -2912,7 +2912,12 @@ xlog_recover_process_data(
>  				xlog_recover_new_tid(&rhash[hash], tid,
>  					be64_to_cpu(rhead->h_lsn));
>  		} else {
> -			ASSERT(dp + be32_to_cpu(ohead->oh_len) <= lp);
> +			if (dp + be32_to_cpu(ohead->oh_len) > lp) {
> +				xlog_warn(
> +			"XFS: xlog_recover_process_data: bad length");
> +				ASSERT(0);
> +				return (XFS_ERROR(EIO));
> +			}

this still gives a panic for debug builds..  Maybe this should become
a WARN_ON(1) instead?

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

end of thread, other threads:[~2007-12-14 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-12  7:07 [PATCH] prevent panic during log recovery due to bogus operation header length Lachlan McIlroy
2007-12-14 20:30 ` Christoph Hellwig

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