From mboxrd@z Thu Jan 1 00:00:00 1970 From: Malcolm Crossley Subject: Re: [PATCH v3] IOMMU: Prevent VT-d device IOTLB operations on wrong IOMMU Date: Tue, 17 Jun 2014 17:15:15 +0100 Message-ID: <53A06993.9010608@citrix.com> References: <0ec71ff08df1f10b1d41.1403015866@malcolmc.uk.xensource.com> <53A07589020000780001B253@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53A07589020000780001B253@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: kevin.tian@intel.com, andrew.cooper3@citrix.com, xen-devel@lists.xen.org, paul.durrant@citrix.com, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org On 17/06/14 16:06, Jan Beulich wrote: >>>> On 17.06.14 at 16:37, 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. Malcolm > Jan >