From: Jeff Cody <jcody@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, prasanna.kalever@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for-2.8] gluster: Fix use after free in glfs_clear_preopened()
Date: Thu, 17 Nov 2016 06:53:41 -0500 [thread overview]
Message-ID: <20161117115341.GB6353@localhost.localdomain> (raw)
In-Reply-To: <1479378608-11962-1-git-send-email-kwolf@redhat.com>
On Thu, Nov 17, 2016 at 11:30:08AM +0100, Kevin Wolf wrote:
> This fixes a use-after-free bug introduced in commit 6349c154. We need
> to use QLIST_FOREACH_SAFE() when freeing elements in the loop. Spotted
> by Coverity.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/gluster.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/block/gluster.c b/block/gluster.c
> index 0ce15f7..891c13b 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -239,12 +239,13 @@ static glfs_t *glfs_find_preopened(const char *volume)
> static void glfs_clear_preopened(glfs_t *fs)
> {
> ListElement *entry = NULL;
> + ListElement *next;
>
> if (fs == NULL) {
> return;
> }
>
> - QLIST_FOREACH(entry, &glfs_list, list) {
> + QLIST_FOREACH_SAFE(entry, &glfs_list, list, next) {
> if (entry->saved.fs == fs) {
> if (--entry->saved.ref) {
> return;
> --
> 1.8.3.1
>
Thanks,
Applied to my block branch:
git://github.com/codyprime/qemu-kvm-jtc.git block
-Jeff
prev parent reply other threads:[~2016-11-17 11:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 10:30 [Qemu-devel] [PATCH for-2.8] gluster: Fix use after free in glfs_clear_preopened() Kevin Wolf
2016-11-17 11:53 ` Jeff Cody [this message]
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=20161117115341.GB6353@localhost.localdomain \
--to=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=prasanna.kalever@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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).