xfsprogs/fsr-fix-uninitialized-fs-usage-after-timeout.patch
Jeff Mahoney 594a67f3fa Accepting request 505781 from home:jeff_mahoney:branches:filesystems
- Fix crash in xfs_repair when threads fail to start (bsc#1019938).
  * xfs_repair-clear-pthread_t-when-pthread_create-fails.patch
  * Added xfs_repair-add-prefetch-trace-calls-to-debug-thread-creation-failures.patch
  * xfs_repair-fix-thread-creation-failure-recovery.patch

- fsr: fix uninitialized fs usage after timeout (bsc#1002699).
  * Added fsr-fix-uninitialized-fs-usage-after-timeout.patch

OBS-URL: https://build.opensuse.org/request/show/505781
OBS-URL: https://build.opensuse.org/package/show/filesystems/xfsprogs?expand=0&rev=49
2017-06-22 20:20:58 +00:00

40 lines
1.1 KiB
Diff

From: Jeff Mahoney <jeffm@suse.com>
Date: Fri, 2 Jun 2017 14:15:41 -0400
Subject: fsr: fix uninitialized fs usage after timeout
Patch-mainline: Submitted to linux-xfs, 2 Jun 2017
References: bsc#1002699
In the main loop of fsrallfs, we exit when we've hit the timeout but
we increment fs before we get there. If we're operating on the last
file system in the array, we'll hit an uninitialized fsdesc and
crash in fsrall_cleanup.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fsr/xfs_fsr.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 517b75f0..e695c243 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -598,7 +598,7 @@ fsrallfs(char *mtab, int howlong, char *leftofffile)
signal(SIGTERM, aborter);
/* reorg for 'howlong' -- checked in 'fsrfs' */
- while (endtime > time(0)) {
+ for (; endtime > time(0); fs->npass++, fs++) {
pid_t pid;
if (fs == fsend)
fs = fsbase;
@@ -629,8 +629,6 @@ fsrallfs(char *mtab, int howlong, char *leftofffile)
break;
}
startino = 0; /* reset after the first time through */
- fs->npass++;
- fs++;
}
fsrall_cleanup(endtime <= time(0));
}