linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsr: fix uninitialized fs usage after timeout
@ 2017-06-02 18:20 Jeff Mahoney
  2017-06-21 19:28 ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Mahoney @ 2017-06-02 18:20 UTC (permalink / raw)
  To: linux-xfs

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));
 }


-- 
Jeff Mahoney
SUSE Labs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-21 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-02 18:20 [PATCH] fsr: fix uninitialized fs usage after timeout Jeff Mahoney
2017-06-21 19:28 ` Eric Sandeen
2017-06-21 21:49   ` Jeff Mahoney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).