[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3] IOMMU: Prevent VT-d device IOTLB operations on wrong IOMMU



>>> Malcolm Crossley <malcolm.crossley@xxxxxxxxxx> 06/17/14 6:15 PM >>>
>On 17/06/14 16:06, Jan Beulich wrote:
>>>>> On 17.06.14 at 16:37, <malcolm.crossley@xxxxxxxxxx> wrote:
>>> --- a/xen/drivers/passthrough/vtd/x86/ats.c
>>> +++ b/xen/drivers/passthrough/vtd/x86/ats.c
>>> @@ -120,6 +120,10 @@ int dev_invalidate_iotlb(struct iommu *i
>>>      {
>>>          sid = (pdev->bus << 8) | pdev->devfn;
>>>  
>>> +        /* Only invalidate devices that belong to this IOMMU */
>>> +        if ( !pdev->iommu || pdev->iommu != iommu )
>>> +            continue;
>> 
>> I meant to ask before and then forgot: What is the first half of this
>> condition good/needed for?
>>
>Defensive coding to prevent a NULL pointer deference if the Intel or
>core ATS code goes wrong.

But there is no de-reference of the pointer anywhere - you added it just as
a token for comparison purposes. If pdev->iommu was NULL, the right side
comparison should still produce "false"...

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.