iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: Yi Sun <yi.y.sun@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, dwmw2@infradead.org,
	iommu@lists.linux-foundation.org
Subject: Re: [PATCH v1 2/3] iommu: Fix an issue in iommu_page_response() flags check
Date: Wed, 28 Oct 2020 10:13:56 +0100	[thread overview]
Message-ID: <20201028091356.GB2328726@myrica> (raw)
In-Reply-To: <1603849018-6578-3-git-send-email-yi.y.sun@linux.intel.com>

Hi,

On Wed, Oct 28, 2020 at 09:36:57AM +0800, Yi Sun wrote:
> From: Jacob Pan <jacob.jun.pan@linux.intel.com>
> 
> original code fails when LAST_PAGE is set in flags.

LAST_PAGE is not documented to be a valid flags for page_response.
So isn't failing the right thing to do?

> 
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
> ---
>  drivers/iommu/iommu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 8c470f4..053cec3 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -1200,9 +1200,11 @@ int iommu_page_response(struct device *dev,
>  		return -EINVAL;
>  
>  	if (msg->version != IOMMU_PAGE_RESP_VERSION_1 ||
> -	    msg->flags & ~IOMMU_PAGE_RESP_PASID_VALID)
> +		!(msg->flags & IOMMU_PAGE_RESP_PASID_VALID)) {

It should be OK not to have PASID_VALID set, we're just checking for
undefined flags here.

Thanks,
Jean

> +		dev_warn_ratelimited(dev, "%s:Invalid ver %x: flags %x\n",
> +				__func__, msg->version, msg->flags);
>  		return -EINVAL;
> -
> +	}
>  	/* Only send response if there is a fault report pending */
>  	mutex_lock(&param->fault_param->lock);
>  	if (list_empty(&param->fault_param->faults)) {
> -- 
> 2.7.4
> 
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-10-28  9:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  1:36 [PATCH v1 0/3] iommu: Fix a few issues related to PRQ Yi Sun
2020-10-28  1:36 ` [PATCH v1 1/3] iommu/vt-d: Fix prq reporting issues Yi Sun
2020-10-28  4:50   ` Lu Baolu
2020-10-28  6:05     ` Yi Sun
2020-10-28  1:36 ` [PATCH v1 2/3] iommu: Fix an issue in iommu_page_response() flags check Yi Sun
2020-10-28  9:13   ` Jean-Philippe Brucker [this message]
2020-10-29  6:30     ` Yi Sun
2020-10-28  1:36 ` [PATCH v1 3/3] iommu/vt-d: Fix a bug for PDP check in prq_event_thread Yi Sun
2020-10-28  5:05   ` Lu Baolu
2020-10-28  6:06     ` Yi Sun

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=20201028091356.GB2328726@myrica \
    --to=jean-philippe@linaro.org \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yi.y.sun@linux.intel.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).