All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Tommaso Califano <tcalifan@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Nguyen Dinh Phi" <phind.uet@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: Re: [PATCH] hw/usb: Fix USB MTP Use-After-Free in usb_mtp_deletefn List Iteration
Date: Wed, 23 Sep 2026 17:48:36 +0100	[thread overview]
Message-ID: <arQC5FcLbJCWOdLk@redhat.com> (raw)
In-Reply-To: <20260916161826.223733-1-tcalifan@redhat.com>

On Wed, Sep 16, 2026 at 06:18:26PM +0200, Tommaso Califano wrote:
> In QEMU's USB MTP (Media Transfer Protocol) device emulation, the usb_mtp_deletefn()
> function in hw/usb/dev-mtp.c iterates over a child object list using QLIST_FOREACH
> while the recursive call may free the current element. After the free, the macro reads
> the le_next field from freed memory to advance the iterator.
> 
> Replace QLIST_FOREACH with QLIST_FOREACH_SAFE, which saves the next pointer before the
> iteration body executes.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3991
> Signed-off-by: Tommaso Califano <tcalifan@redhat.com>
> ---
>  hw/usb/dev-mtp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



      reply	other threads:[~2026-09-23 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 16:18 [PATCH] hw/usb: Fix USB MTP Use-After-Free in usb_mtp_deletefn List Iteration Tommaso Califano
2026-09-23 16:48 ` Daniel P. Berrangé [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=arQC5FcLbJCWOdLk@redhat.com \
    --to=berrange@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=phind.uet@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tcalifan@redhat.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 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.