From: Igor Mammedov <imammedo@redhat.com>
To: xen-devel@lists.xensource.com
Cc: keir@xen.org, allen.m.kay@intel.com
Subject: [Xen HV PATCH] VT-d: Fix resource leaks on error paths
Date: Thu, 12 May 2011 10:30:07 +0200 [thread overview]
Message-ID: <1305189007-16043-1-git-send-email-imammedo@redhat.com> (raw)
On error exit from functions, maped pages should be unmapped
and acquired locks released.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
diff -r 4b0692880dfa -r da93d9e43b3c xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c Thu May 05 17:40:34 2011 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c Wed May 11 12:29:54 2011 +0200
@@ -210,7 +210,8 @@
if ( iremap_entries )
unmap_vtd_domain_page(iremap_entries);
- ir_ctrl->iremap_num++;
+ if ( i < IREMAP_ENTRY_NR )
+ ir_ctrl->iremap_num++;
return i;
}
@@ -246,6 +247,8 @@
dprintk(XENLOG_ERR VTDPREFIX,
"%s: index (%d) get an empty entry!\n",
__func__, index);
+ unmap_vtd_domain_page(iremap_entries);
+ spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
return -EFAULT;
}
@@ -281,7 +284,8 @@
if ( index < 0 )
{
index = alloc_remap_entry(iommu);
- apic_pin_2_ir_idx[apic][ioapic_pin] = index;
+ if ( index < IREMAP_ENTRY_NR )
+ apic_pin_2_ir_idx[apic][ioapic_pin] = index;
}
if ( index > IREMAP_ENTRY_NR - 1 )
@@ -546,6 +550,8 @@
dprintk(XENLOG_ERR VTDPREFIX,
"%s: index (%d) get an empty entry!\n",
__func__, index);
+ unmap_vtd_domain_page(iremap_entries);
+ spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
return -EFAULT;
}
next reply other threads:[~2011-05-12 8:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 8:30 Igor Mammedov [this message]
2011-05-13 17:48 ` [Xen HV PATCH] VT-d: Fix resource leaks on error paths Kay, Allen M
-- strict thread matches above, loose matches on Subject: below --
2011-05-11 11:45 Igor Mammedov
2011-05-12 8:11 ` Keir Fraser
2011-05-12 8:26 ` Igor Mammedov
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=1305189007-16043-1-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=allen.m.kay@intel.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xensource.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 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).