* [Xen HV PATCH] VT-d: Fix resource leaks on error paths
@ 2011-05-11 11:45 Igor Mammedov
2011-05-12 8:11 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: Igor Mammedov @ 2011-05-11 11:45 UTC (permalink / raw)
To: xen-devel; +Cc: rhkernel-list
On error exit from function, maped pages should be unmapped
and acquired locks released.
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;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen HV PATCH] VT-d: Fix resource leaks on error paths
2011-05-11 11:45 [Xen HV PATCH] VT-d: Fix resource leaks on error paths Igor Mammedov
@ 2011-05-12 8:11 ` Keir Fraser
2011-05-12 8:26 ` Igor Mammedov
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2011-05-12 8:11 UTC (permalink / raw)
To: Igor Mammedov, xen-devel; +Cc: Kay, Allen M, rhkernel-list
Will need an Ack from a VT-d maintainer (Allen Kay is listed in our
MAINTAINERS file, and is CC'ed). Also needs a Signed-off-by line.
-- Keir
On 11/05/2011 12:45, "Igor Mammedov" <imammedo@redhat.com> wrote:
> On error exit from function, maped pages should be unmapped
> and acquired locks released.
>
> 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;
> }
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen HV PATCH] VT-d: Fix resource leaks on error paths
2011-05-12 8:11 ` Keir Fraser
@ 2011-05-12 8:26 ` Igor Mammedov
0 siblings, 0 replies; 5+ messages in thread
From: Igor Mammedov @ 2011-05-12 8:26 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, Kay, Allen M
Thanks Keir,
I'll repost patch and cc Allen
On 05/12/2011 10:11 AM, Keir Fraser wrote:
> Will need an Ack from a VT-d maintainer (Allen Kay is listed in our
> MAINTAINERS file, and is CC'ed). Also needs a Signed-off-by line.
>
> -- Keir
>
> On 11/05/2011 12:45, "Igor Mammedov"<imammedo@redhat.com> wrote:
>
>> On error exit from function, maped pages should be unmapped
>> and acquired locks released.
>>
>> 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;
>> }
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [Xen HV PATCH] VT-d: Fix resource leaks on error paths
2011-05-12 8:30 Igor Mammedov
@ 2011-05-13 17:48 ` Kay, Allen M
0 siblings, 0 replies; 5+ messages in thread
From: Kay, Allen M @ 2011-05-13 17:48 UTC (permalink / raw)
To: Igor Mammedov, xen-devel; +Cc: keir
Looks good to me. ACK!
-----Original Message-----
From: Igor Mammedov [mailto:imammedo@redhat.com]
Sent: Thursday, May 12, 2011 1:30 AM
To: xen-devel@lists.xensource.com
Cc: Kay, Allen M; keir@xen.org
Subject: [Xen HV PATCH] VT-d: Fix resource leaks on error paths
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;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Xen HV PATCH] VT-d: Fix resource leaks on error paths
@ 2011-05-12 8:30 Igor Mammedov
2011-05-13 17:48 ` Kay, Allen M
0 siblings, 1 reply; 5+ messages in thread
From: Igor Mammedov @ 2011-05-12 8:30 UTC (permalink / raw)
To: xen-devel; +Cc: keir, allen.m.kay
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;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-13 17:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 11:45 [Xen HV PATCH] VT-d: Fix resource leaks on error paths Igor Mammedov
2011-05-12 8:11 ` Keir Fraser
2011-05-12 8:26 ` Igor Mammedov
2011-05-12 8:30 Igor Mammedov
2011-05-13 17:48 ` Kay, Allen M
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.