]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_scrub: don't call phase_end if phase_rusage was not initialized
authorAndrey Albershteyn <aalbersh@redhat.com>
Tue, 23 Apr 2024 12:36:16 +0000 (14:36 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 23 Apr 2024 13:02:58 +0000 (15:02 +0200)
If unicrash_load() fails, all_pi can be used uninitialized in
phase_end(). Fix it by going to the unload: section if unicrash_load
fails and just go with unicrash_unload() (the is_service won't be
initialized here).

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
scrub/xfs_scrub.c

index 752180d646ba9eccd470bfb09590ac2237042b2c..50565857ddd81aa8c551350e2cc7bd2ebe0ec84a 100644 (file)
@@ -631,7 +631,7 @@ main(
                fprintf(stderr,
        _("%s: couldn't initialize Unicode library.\n"),
                                progname);
-               goto out;
+               goto out_unicrash;
        }
 
        pthread_mutex_init(&ctx.lock, NULL);
@@ -828,6 +828,7 @@ out:
        phase_end(&all_pi, 0);
        if (progress_fp)
                fclose(progress_fp);
+out_unicrash:
        unicrash_unload();
 
        /*