All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: SeokYeon Hwang <syeon.hwang@samsung.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pci: add checking whether the device is realized before unlinking the capability
Date: Wed, 25 Jun 2014 15:03:30 +0300	[thread overview]
Message-ID: <20140625120330.GA13856@redhat.com> (raw)
In-Reply-To: <1403690348-19267-1-git-send-email-syeon.hwang@samsung.com>

On Wed, Jun 25, 2014 at 06:59:08PM +0900, SeokYeon Hwang wrote:
> In case of the unrealized "pdev", memory can be illegally accessed and corrupted.
> Refer to device_unparent() in the commit 5c21ce77d7e5643089ceec556c0408445d017f32.
> 
> Change-Id: Iacb195a092c86d4c677ad0404582af104b2251ae
> Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>

Another case of qemu mailing list dropping patches :(
I will bounce it now so people can see the original
message.


> ---
>  hw/pci/pci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 49eca95..bb7f0c5 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2056,7 +2056,12 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,
>  /* Unlink capability from the pci config space. */
>  void pci_del_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t size)
>  {
> -    uint8_t prev, offset = pci_find_capability_list(pdev, cap_id, &prev);
> +    uint8_t prev, offset;
> +    /* Check whether the device is realized or not */
> +    if (!pdev->qdev.realized) {
> +        return;
> +    }
> +    offset = pci_find_capability_list(pdev, cap_id, &prev);
>      if (!offset)
>          return;
>      pdev->config[prev] = pdev->config[offset + PCI_CAP_LIST_NEXT];
> -- 
> 1.9.1

  reply	other threads:[~2014-06-25 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25  9:59 [Qemu-devel] [PATCH] pci: add checking whether the device is realized before unlinking the capability SeokYeon Hwang
2014-06-25 12:03 ` Michael S. Tsirkin [this message]
2014-06-25 12:28   ` Marcel Apfelbaum
2014-06-26  3:48     ` SeokYeon Hwang
2014-06-26  7:07       ` Michael S. Tsirkin
2014-06-28  6:39         ` SeokYeon Hwang

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=20140625120330.GA13856@redhat.com \
    --to=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=syeon.hwang@samsung.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.