public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH 1/2] xfsdump: avoid segfault in partial_reg() in error case
Date: Tue, 08 Oct 2013 17:05:54 -0500	[thread overview]
Message-ID: <525481C2.6040100@sandeen.net> (raw)
In-Reply-To: <525480A6.3000202@redhat.com>

If we go down the "/* Should never get here. */" path
in partial_reg(), we issue a warning but then continue
with the function.  This calls pi_unlock() twice,
but worse, uses a null isptr:

        if ( ! isptr ) {
... isptr is never set if we get to ...
                /* Should never get here. */
                pi_unlock();
...
        }
...
        /* Update this drive's entry */
        bsptr = &isptr->is_bs[d_index];
        if (bsptr->endoffset == 0) {

>From all appearances, because we unlock on that "never get
here" path, it should just be returning after printing the
warning.  So add that, and we avoid the segfault.

The previous fix to partial_reg() should prevent us from
hitting this in the first place.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/restore/content.c b/restore/content.c
index 54d933c..cc49336 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -9007,6 +9007,7 @@ partial_reg( ix_t d_index,
 #ifdef DEBUGPARTIALS
 		dump_partials();
 #endif
+		return;
 	}
 
 found:

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-10-08 22:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 22:01 [PATCH 0/2] xfsdump: 2 more fixes Eric Sandeen
2013-10-08 22:05 ` Eric Sandeen [this message]
2013-10-10 14:17   ` [PATCH 1/2] xfsdump: avoid segfault in partial_reg() in error case Carlos Maiolino
2013-10-18 21:29   ` Rich Johnston
2013-10-08 22:31 ` [PATCH 2/2] xfsdump: fix DEBUGPARTIALS build Eric Sandeen
2013-10-10 14:21   ` Carlos Maiolino
2013-10-18 21:30   ` Rich Johnston

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=525481C2.6040100@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /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