All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Li Qiang <liq3ea@gmail.com>
Cc: aneesh.kumar@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	Li Qiang <liqiang6-s@360.cn>
Subject: Re: [Qemu-devel] [PATCH] 9pfs: fix potential host memory leak in v9fs_read
Date: Mon, 10 Oct 2016 13:16:04 +0200	[thread overview]
Message-ID: <20161010131604.0c31cfc4@bahia> (raw)
In-Reply-To: <57ea5f06.821e6b0a.4ee38.31ea@mx.google.com>

On Tue, 27 Sep 2016 04:58:46 -0700
Li Qiang <liq3ea@gmail.com> wrote:

> From: Li Qiang <liqiang6-s@360.cn>
> 
> In 9pfs read dispatch function, it doesn't free two QEMUIOVector
> object thus causing potential memory leak. This patch avoid this.
> 
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/9pfs/9p.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 119ee58..543a791 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
>              if (len < 0) {
>                  /* IO error return the error */
>                  err = len;
> -                goto out;
> +                goto out_free_iovec;
>              }
>          } while (count < max_count && len > 0);
>          err = pdu_marshal(pdu, offset, "d", count);
>          if (err < 0) {
> -            goto out;
> +            goto out_free_iovec;
>          }
>          err += offset + count;
> +out_free_iovec:
>          qemu_iovec_destroy(&qiov);
>          qemu_iovec_destroy(&qiov_full);
>      } else if (fidp->fid_type == P9_FID_XATTR) {

  parent reply	other threads:[~2016-10-10 11:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 11:58 [Qemu-devel] [PATCH] 9pfs: fix potential host memory leak in v9fs_read Li Qiang
2016-09-27 15:41 ` Greg Kurz
2016-10-10 11:16 ` Greg Kurz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-09-27  4:42 Li Qiang
2016-09-27  8:14 ` Greg Kurz

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=20161010131604.0c31cfc4@bahia \
    --to=groug@kaod.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=liq3ea@gmail.com \
    --cc=liqiang6-s@360.cn \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.