From: Jeff Mahoney <jeffm@suse.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] fsr: fix uninitialized fs usage after timeout
Date: Fri, 2 Jun 2017 14:20:04 -0400 [thread overview]
Message-ID: <b4921f6d-01c7-09eb-641f-47f1be998e61@suse.com> (raw)
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
next reply other threads:[~2017-06-02 18:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 18:20 Jeff Mahoney [this message]
2017-06-21 19:28 ` [PATCH] fsr: fix uninitialized fs usage after timeout Eric Sandeen
2017-06-21 21:49 ` Jeff Mahoney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4921f6d-01c7-09eb-641f-47f1be998e61@suse.com \
--to=jeffm@suse.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).