[Top] [All Lists]

[PATCH 1/2] xfsdump: avoid segfault in partial_reg() in error case

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH 1/2] xfsdump: avoid segfault in partial_reg() in error case
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 08 Oct 2013 17:05:54 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <525480A6.3000202@xxxxxxxxxx>
References: <525480A6.3000202@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
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. */
        /* 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@xxxxxxxxxx>

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,
+               return;

<Prev in Thread] Current Thread [Next in Thread>