From ecfe1395c5c2df6093a533dd1deaa5fad1b82570 Mon Sep 17 00:00:00 2001 From: liuh Date: Sat, 6 Jul 2024 23:56:49 +0800 Subject: [PATCH] xfs_scrub: don't call phase_end if phase_rusage was not initialized (cherry picked from commit 561d0f0e50c68052006347f45e9768bec2700176) --- ...call-phase_end-if-phase_rusage-was-n.patch | 42 +++++++++++++++++++ xfsprogs.spec | 6 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch diff --git a/0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch b/0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch new file mode 100644 index 0000000..6d9f857 --- /dev/null +++ b/0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch @@ -0,0 +1,42 @@ +From c4dd920b8a8900046e0785e55a43c7190b82c59a Mon Sep 17 00:00:00 2001 +From: Andrey Albershteyn +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 +Reviewed-by: Bill O'Donnell +Reviewed-by: Christoph Hellwig +Signed-off-by: Andrey Albershteyn +--- + 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 + diff --git a/xfsprogs.spec b/xfsprogs.spec index 78563e1..abb028f 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -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 - 6.6.0-7 +- xfs_scrub: don't call phase_end if phase_rusage was not initialized + * Fri Jun 21 2024 liuh - 6.6.0-6 - sync pathc from community xfs_io: fix mread with length 1 mod page size -- Gitee