diff --git a/0004-xfs_db-fix-leak-in-flist_find_ftyp.patch b/0004-xfs_db-fix-leak-in-flist_find_ftyp.patch new file mode 100644 index 0000000000000000000000000000000000000000..e0e04131370800c6c835d4fd9ca86eed8d18de73 --- /dev/null +++ b/0004-xfs_db-fix-leak-in-flist_find_ftyp.patch @@ -0,0 +1,35 @@ +From 21dc682a3842eb7e4c79f7e511d840e708d7e757 Mon Sep 17 00:00:00 2001 +From: Andrey Albershteyn +Date: Tue, 23 Apr 2024 14:36:14 +0200 +Subject: xfs_db: fix leak in flist_find_ftyp() + +When count is zero fl reference is lost. Fix it by freeing the list. + +Fixes: a0d79cb37a36 ("xfs_db: make flist_find_ftyp() to check for field existance on disk") +Reviewed-by: Darrick J. Wong +Reviewed-by: Bill O'Donnell +Reviewed-by: Christoph Hellwig +Signed-off-by: Andrey Albershteyn +--- + db/flist.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/db/flist.c b/db/flist.c +index c81d229..0a6cc5f 100644 +--- a/db/flist.c ++++ b/db/flist.c +@@ -424,8 +424,10 @@ flist_find_ftyp( + if (f->ftyp == type) + return fl; + count = fcount(f, obj, startoff); +- if (!count) ++ if (!count) { ++ flist_free(fl); + continue; ++ } + fa = &ftattrtab[f->ftyp]; + if (fa->subfld) { + flist_t *nfl; +-- +2.27.0 + diff --git a/0005-xfs_db-add-helper-for-flist_find_type-for-clearer-fi.patch b/0005-xfs_db-add-helper-for-flist_find_type-for-clearer-fi.patch new file mode 100644 index 0000000000000000000000000000000000000000..8bd4fc2a86819abdff1fc939273a626b35301eb2 --- /dev/null +++ b/0005-xfs_db-add-helper-for-flist_find_type-for-clearer-fi.patch @@ -0,0 +1,101 @@ +From a21daa3a739194b929de644779c359949390d467 Mon Sep 17 00:00:00 2001 +From: Andrey Albershteyn +Date: Wed, 17 Apr 2024 18:19:30 +0200 +Subject: xfs_db: add helper for flist_find_type for clearer field matching + +Make flist_find_type() more readable by unloading field type +matching to the helper. + +Signed-off-by: Andrey Albershteyn +Reviewed-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +--- + db/flist.c | 60 ++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 38 insertions(+), 22 deletions(-) + +diff --git a/db/flist.c b/db/flist.c +index 0a6cc5f..ab0a0f1 100644 +--- a/db/flist.c ++++ b/db/flist.c +@@ -400,6 +400,40 @@ flist_split( + return v; + } + ++static flist_t * ++flist_field_match( ++ const field_t *field, ++ fldt_t type, ++ void *obj, ++ int startoff) ++{ ++ flist_t *fl; ++ int count; ++ const ftattr_t *fa; ++ flist_t *nfl; ++ ++ fl = flist_make(field->name); ++ fl->fld = field; ++ if (field->ftyp == type) ++ return fl; ++ count = fcount(field, obj, startoff); ++ if (!count) ++ goto out; ++ fa = &ftattrtab[field->ftyp]; ++ if (!fa->subfld) ++ goto out; ++ ++ nfl = flist_find_ftyp(fa->subfld, type, obj, startoff); ++ if (nfl) { ++ fl->child = nfl; ++ return fl; ++ } ++ ++out: ++ flist_free(fl); ++ return NULL; ++} ++ + /* + * Given a set of fields, scan for a field of the given type. + * Return an flist leading to the first found field +@@ -413,33 +447,15 @@ flist_find_ftyp( + void *obj, + int startoff) + { +- flist_t *fl; + const field_t *f; +- int count; +- const ftattr_t *fa; ++ flist_t *fl; + + for (f = fields; f->name; f++) { +- fl = flist_make(f->name); +- fl->fld = f; +- if (f->ftyp == type) ++ fl = flist_field_match(f, type, obj, startoff); ++ if (fl) + return fl; +- count = fcount(f, obj, startoff); +- if (!count) { +- flist_free(fl); +- continue; +- } +- fa = &ftattrtab[f->ftyp]; +- if (fa->subfld) { +- flist_t *nfl; +- +- nfl = flist_find_ftyp(fa->subfld, type, obj, startoff); +- if (nfl) { +- fl->child = nfl; +- return fl; +- } +- } +- flist_free(fl); + } ++ + return NULL; + } + +-- +2.27.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index dd3324a85b7d5bdfad63779f7de70b0436325a7d..fcc2727194a734ad8f5caeb38ffbba0f3a4ca3e9 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 6.6.0 -Release: 4 +Release: 5 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -22,6 +22,8 @@ Patch0: xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch Patch1: 0001-xfsprogs-Add-sw64-architecture.patch Patch2: 0002-xfs-fix-internal-error-from-AGFL-exhaustion.patch 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 %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -105,6 +107,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Tue Jun 4 2024 liuh - 6.6.0-5 +- sync patches from community + * Wed May 08 2024 chendexi - 6.6.0-4 - Remove xfs_scrub related files from the main package to remove python dependencies