linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikita Danilov <Nikita@Namesys.COM>
To: Linus Torvalds <Torvalds@Transmeta.COM>
Cc: Reiserfs developers mail-list <Reiserfs-Dev@Namesys.COM>,
	"Linux kernel developer's mailing list" 
	<linux-kernel@vger.kernel.org>
Subject: [PATCH]: reiserfs: A-panic-in-reiserfs_read_super.patch
Date: Thu, 30 Aug 2001 18:21:44 +0400	[thread overview]
Message-ID: <15246.19448.805095.697159@gargle.gargle.HOWL> (raw)

Hello, Linus,

    This patch allows reiserfs to cope with an attempt to mount file-system
    with corrupted super-block: reiserfs stores both version-dependent magic
    and version itself in a super-block. This patch just returns error
    rather than panics if they don't match.

(This patch is bug fix just like most other patches I'll send today.
Linus, I sent them several (four, I guess) times already, but they
didn't get in. Can you please clarify on this, because we are so
confused.)

This patch is against 2.4.10-pre2.
Please apply.

Nikita.
diff -rup linux/fs/reiserfs/super.c linux.patched/fs/reiserfs/super.c
--- linux/fs/reiserfs/super.c	Wed Jul  4 13:45:55 2001
+++ linux.patched/fs/reiserfs/super.c	Wed Aug  1 21:08:16 2001
@@ -779,16 +779,23 @@ struct super_block * reiserfs_read_super
 
     if (!(s->s_flags & MS_RDONLY)) {
 	struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
+	int old_magic;
+
+	old_magic = strncmp (rs->s_magic,  REISER2FS_SUPER_MAGIC_STRING, 
+			     strlen ( REISER2FS_SUPER_MAGIC_STRING));
+	if( old_magic && le16_to_cpu(rs->s_version) != 0 ) {
+	  dput(s->s_root) ;
+	  s->s_root = NULL ;
+	  reiserfs_warning("reiserfs: wrong version/magic combination in the super-block\n") ;
+	  goto error ;
+	}
 
 	journal_begin(&th, s, 1) ;
 	reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1) ;
 
 	rs->s_state = cpu_to_le16 (REISERFS_ERROR_FS);
 
-        if (strncmp (rs->s_magic,  REISER2FS_SUPER_MAGIC_STRING, 
-		     strlen ( REISER2FS_SUPER_MAGIC_STRING))) {
-	    if (le16_to_cpu(rs->s_version) != 0)
-		BUG ();
+        if ( old_magic ) {
 	    // filesystem created under 3.5.x found
 	    if (!old_format_only (s)) {
 		reiserfs_warning("reiserfs: converting 3.5.x filesystem to the new format\n") ;

             reply	other threads:[~2001-08-30 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-30 14:21 Nikita Danilov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-08-02 14:08 [PATCH]: reiserfs: A-panic-in-reiserfs_read_super.patch Nikita Danilov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15246.19448.805095.697159@gargle.gargle.HOWL \
    --to=nikita@namesys.com \
    --cc=Reiserfs-Dev@Namesys.COM \
    --cc=Torvalds@Transmeta.COM \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).