!123 [sync] PR-118: xfs_scrub: don't call phase_end if phase_rusage was not initialized

From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
This commit is contained in:
openeuler-ci-bot 2024-07-12 02:53:07 +00:00 committed by Gitee
commit cdefeabd1a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From c4dd920b8a8900046e0785e55a43c7190b82c59a Mon Sep 17 00:00:00 2001
From: Andrey Albershteyn <aalbersh@redhat.com>
Date: Tue, 23 Apr 2024 14:36:16 +0200
Subject: xfs_scrub: don't call phase_end if phase_rusage was not initialized
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c
index 752180d..5056585 100644
--- a/scrub/xfs_scrub.c
+++ b/scrub/xfs_scrub.c
@@ -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();
/*
--
2.43.0

View File

@ -1,6 +1,6 @@
Name: xfsprogs
Version: 6.6.0
Release: 6
Release: 7
Summary: Administration and debugging tools for the XFS file system
License: GPL+ and LGPLv2+
URL: https://xfs.wiki.kernel.org
@ -25,6 +25,7 @@ Patch3: 0003-xfs_db-don-t-hardcode-type-data-size-at-512b.patch
Patch4: 0004-xfs_db-fix-leak-in-flist_find_ftyp.patch
Patch5: 0005-xfs_db-add-helper-for-flist_find_type-for-clearer-fi.patch
Patch6: 0006-xfs_io-fix-mread-with-length-1-mod-page-size.patch
Patch7: 0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch
%description
xfsprogs are the userspace utilities that manage XFS filesystems.
@ -108,6 +109,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/
%changelog
* Sat Jul 6 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-7
- xfs_scrub: don't call phase_end if phase_rusage was not initialized
* Fri Jun 21 2024 liuh <liuhuan01@kylinos.cn> - 6.6.0-6
- sync pathc from community
xfs_io: fix mread with length 1 mod page size