From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] xfs_repair: fix array overrun in do_inode_prefetch
Date: Mon, 03 Mar 2014 13:13:58 -0600 [thread overview]
Message-ID: <5314D476.7030503@redhat.com> (raw)
Coverity spotted this:
do_inode_prefetch() does a while loop, creating queues:
for (i = 0; i < thread_count; i++) {
...
create_work_queue(&queues[i], mp, 1);
...
}
and then does this to wait for them all to complete:
for (; i >= 0; i--)
destroy_work_queue(&queues[i]);
But we leave the first for loop with (i == thread_coun)t, and
the second one will try to index queues[] one past the end.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 0f9e3fe..e47a48e 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -995,7 +995,7 @@ do_inode_prefetch(
/*
* wait for workers to complete
*/
- for (; i >= 0; i--)
+ while (i--)
destroy_work_queue(&queues[i]);
free(queues);
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2014-03-03 19:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 19:13 Eric Sandeen [this message]
2014-03-03 23:10 ` [PATCH] xfs_repair: fix array overrun in do_inode_prefetch Dave Chinner
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=5314D476.7030503@redhat.com \
--to=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/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