From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754113AbdKFUNL (ORCPT ); Mon, 6 Nov 2017 15:13:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47744 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753598AbdKFUNK (ORCPT ); Mon, 6 Nov 2017 15:13:10 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 813B3C057FAF Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=alex.williamson@redhat.com Date: Mon, 6 Nov 2017 13:13:09 -0700 From: Alex Williamson To: Lu Baolu Cc: joro@8bytes.org, dwmw2@infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails Message-ID: <20171106131309.6bc1084a@t450s.home> In-Reply-To: <1508373556-5340-1-git-send-email-baolu.lu@linux.intel.com> References: <1508373556-5340-1-git-send-email-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 06 Nov 2017 20:13:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Oct 2017 08:39:14 +0800 Lu Baolu wrote: > intel_svm_alloc_pasid_tables() might return an error but never be > checked by the callers. Later when intel_svm_bind_mm() is called, > there are no checks for valid pasid tables before enabling them. > > Signed-off-by: Ashok Raj > Signed-off-by: Lu Baolu > --- > drivers/iommu/intel-svm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c > index f6697e5..43280ca 100644 > --- a/drivers/iommu/intel-svm.c > +++ b/drivers/iommu/intel-svm.c > @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ > int pasid_max; > int ret; > > - if (WARN_ON(!iommu)) > + if (WARN_ON(!iommu || !iommu->pasid_table)) > return -EINVAL; > > if (dev_is_pci(dev)) { Applied series to iommu/vt-d for v4.15. Thanks, Alex From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails Date: Mon, 6 Nov 2017 13:13:09 -0700 Message-ID: <20171106131309.6bc1084a@t450s.home> References: <1508373556-5340-1-git-send-email-baolu.lu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1508373556-5340-1-git-send-email-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Lu Baolu Cc: dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Thu, 19 Oct 2017 08:39:14 +0800 Lu Baolu wrote: > intel_svm_alloc_pasid_tables() might return an error but never be > checked by the callers. Later when intel_svm_bind_mm() is called, > there are no checks for valid pasid tables before enabling them. > > Signed-off-by: Ashok Raj > Signed-off-by: Lu Baolu > --- > drivers/iommu/intel-svm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c > index f6697e5..43280ca 100644 > --- a/drivers/iommu/intel-svm.c > +++ b/drivers/iommu/intel-svm.c > @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ > int pasid_max; > int ret; > > - if (WARN_ON(!iommu)) > + if (WARN_ON(!iommu || !iommu->pasid_table)) > return -EINVAL; > > if (dev_is_pci(dev)) { Applied series to iommu/vt-d for v4.15. Thanks, Alex