From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Cc: Keir Fraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH 2/4] AMD/iommu_detect: Don't leak iommu structure on error paths
Date: Mon, 30 Dec 2013 00:39:16 +0700 [thread overview]
Message-ID: <52C05E44.8060408@amd.com> (raw)
In-Reply-To: <1388156253-14509-3-git-send-email-andrew.cooper3@citrix.com>
On 12/27/2013 09:57 PM, Andrew Cooper wrote:
> Tweak the logic slightly to return the real errors from
> get_iommu_{,msi_}capabilities(), which at the moment is no functional change.
>
> Coverity-ID: 1146950
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> xen/drivers/passthrough/amd/iommu_detect.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/xen/drivers/passthrough/amd/iommu_detect.c b/xen/drivers/passthrough/amd/iommu_detect.c
> index 6c10885..03003d7 100644
> --- a/xen/drivers/passthrough/amd/iommu_detect.c
> +++ b/xen/drivers/passthrough/amd/iommu_detect.c
> @@ -145,11 +145,11 @@ int __init amd_iommu_detect_one_acpi(
> rt = get_iommu_capabilities(iommu->seg, bus, dev, func,
> iommu->cap_offset, iommu);
> if ( rt )
> - return -ENODEV;
> + goto out;
>
> rt = get_iommu_msi_capabilities(iommu->seg, bus, dev, func, iommu);
> if ( rt )
> - return -ENODEV;
> + goto out;
>
> rt = pci_ro_device(iommu->seg, bus, PCI_DEVFN(dev, func));
> if ( rt )
> @@ -158,6 +158,11 @@ int __init amd_iommu_detect_one_acpi(
> iommu->seg, bus, dev, func, rt);
>
> list_add_tail(&iommu->list, &amd_iommu_head);
> + rt = 0;
>
> - return 0;
> +out:
> + if ( rt )
> + xfree(iommu);
> +
> + return rt;
> }
>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
next prev parent reply other threads:[~2013-12-29 17:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 14:57 [PATCH 0/4] Coverity fixes relating to xmalloc()/xfree() Andrew Cooper
2013-12-27 14:57 ` [PATCH 1/4] common/sysctl: Don't leak status in SYSCTL_page_offline_op Andrew Cooper
2014-01-07 11:33 ` Jan Beulich
2014-01-07 11:34 ` Andrew Cooper
2014-01-07 11:48 ` Jan Beulich
2014-01-07 11:59 ` [Patch v2 " Andrew Cooper
2014-01-13 11:13 ` Andrew Cooper
2014-01-17 17:59 ` Keir Fraser
2013-12-27 14:57 ` [PATCH 2/4] AMD/iommu_detect: Don't leak iommu structure on error paths Andrew Cooper
2013-12-29 17:39 ` Suravee Suthikulpanit [this message]
2013-12-27 14:57 ` [PATCH 3/4] AMD/microcode: Avoid use-after-free for the microcode buffer Andrew Cooper
2013-12-27 15:30 ` Boris Ostrovsky
2013-12-27 15:36 ` Andrew Cooper
2013-12-27 15:50 ` Boris Ostrovsky
2013-12-27 15:57 ` [Patch v2 " Andrew Cooper
2013-12-27 22:43 ` Matthew Daley
2013-12-28 11:24 ` Andrew Cooper
2013-12-28 11:28 ` [Patch v3 " Andrew Cooper
2013-12-27 14:57 ` [PATCH 4/4] VTD/DMAR: free() correct pointer on error from acpi_parse_one_atsr() Andrew Cooper
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=52C05E44.8060408@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.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.