All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miles Chen <miles.chen@mediatek.com>
To: <yf.wang@mediatek.com>
Cc: <Libo.Kang@mediatek.com>, <Ning.Li@mediatek.com>,
	<iommu@lists.linux-foundation.org>, <joro@8bytes.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <logang@deltatee.com>,
	<matthias.bgg@gmail.com>, <stable@vger.kernel.org>,
	<will@kernel.org>, <wsd_upstream@mediatek.com>,
	<yong.wu@mediatek.com>
Subject: Re: [PATCH] iommu/dma: Fix iova map result check bug
Date: Mon, 9 May 2022 00:01:15 +0800	[thread overview]
Message-ID: <20220508160115.4851-1-miles.chen@mediatek.com> (raw)
In-Reply-To: <20220507085204.16914-1-yf.wang@mediatek.com>

> The data type of the return value of the iommu_map_sg_atomic
> is ssize_t, but the data type of iova size is size_t,
> e.g. one is int while the other is unsigned int.
> 
> When iommu_map_sg_atomic return value is compared with iova size,
> it will force the signed int to be converted to unsigned int, if
> iova map fails and iommu_map_sg_atomic return error code is less
> than 0, then (ret < iova_len) is false, which will to cause not
> do free iova, and the master can still successfully get the iova
> of map fail, which is not expected.
> 
> Therefore, we need to check the return value of iommu_map_sg_atomic
> in two cases according to whether it is less than 0.
> 
> Fixes: ad8f36e4b6b1 ("iommu: return full error code from iommu_map_sg[_atomic]()")
> Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>

Yes, we have to make sure ssize_t >= 0 before comparing ssize_t and size_t.

Reviewed-by: Miles Chen <miles.chen@mediatek.com> 
>
> Cc: <stable@vger.kernel.org> # 5.15.*

WARNING: multiple messages have this Message-ID (diff)
From: Miles Chen via iommu <iommu@lists.linux-foundation.org>
To: <yf.wang@mediatek.com>
Cc: wsd_upstream@mediatek.com, will@kernel.org,
	linux-kernel@vger.kernel.org, Libo.Kang@mediatek.com,
	iommu@lists.linux-foundation.org,
	linux-mediatek@lists.infradead.org, Ning.Li@mediatek.com,
	matthias.bgg@gmail.com, stable@vger.kernel.org,
	logang@deltatee.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iommu/dma: Fix iova map result check bug
Date: Mon, 9 May 2022 00:01:15 +0800	[thread overview]
Message-ID: <20220508160115.4851-1-miles.chen@mediatek.com> (raw)
In-Reply-To: <20220507085204.16914-1-yf.wang@mediatek.com>

> The data type of the return value of the iommu_map_sg_atomic
> is ssize_t, but the data type of iova size is size_t,
> e.g. one is int while the other is unsigned int.
> 
> When iommu_map_sg_atomic return value is compared with iova size,
> it will force the signed int to be converted to unsigned int, if
> iova map fails and iommu_map_sg_atomic return error code is less
> than 0, then (ret < iova_len) is false, which will to cause not
> do free iova, and the master can still successfully get the iova
> of map fail, which is not expected.
> 
> Therefore, we need to check the return value of iommu_map_sg_atomic
> in two cases according to whether it is less than 0.
> 
> Fixes: ad8f36e4b6b1 ("iommu: return full error code from iommu_map_sg[_atomic]()")
> Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>

Yes, we have to make sure ssize_t >= 0 before comparing ssize_t and size_t.

Reviewed-by: Miles Chen <miles.chen@mediatek.com> 
>
> Cc: <stable@vger.kernel.org> # 5.15.*
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Miles Chen <miles.chen@mediatek.com>
To: <yf.wang@mediatek.com>
Cc: <Libo.Kang@mediatek.com>, <Ning.Li@mediatek.com>,
	<iommu@lists.linux-foundation.org>, <joro@8bytes.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <logang@deltatee.com>,
	<matthias.bgg@gmail.com>, <stable@vger.kernel.org>,
	<will@kernel.org>, <wsd_upstream@mediatek.com>,
	<yong.wu@mediatek.com>
Subject: Re: [PATCH] iommu/dma: Fix iova map result check bug
Date: Mon, 9 May 2022 00:01:15 +0800	[thread overview]
Message-ID: <20220508160115.4851-1-miles.chen@mediatek.com> (raw)
In-Reply-To: <20220507085204.16914-1-yf.wang@mediatek.com>

> The data type of the return value of the iommu_map_sg_atomic
> is ssize_t, but the data type of iova size is size_t,
> e.g. one is int while the other is unsigned int.
> 
> When iommu_map_sg_atomic return value is compared with iova size,
> it will force the signed int to be converted to unsigned int, if
> iova map fails and iommu_map_sg_atomic return error code is less
> than 0, then (ret < iova_len) is false, which will to cause not
> do free iova, and the master can still successfully get the iova
> of map fail, which is not expected.
> 
> Therefore, we need to check the return value of iommu_map_sg_atomic
> in two cases according to whether it is less than 0.
> 
> Fixes: ad8f36e4b6b1 ("iommu: return full error code from iommu_map_sg[_atomic]()")
> Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>

Yes, we have to make sure ssize_t >= 0 before comparing ssize_t and size_t.

Reviewed-by: Miles Chen <miles.chen@mediatek.com> 
>
> Cc: <stable@vger.kernel.org> # 5.15.*

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Miles Chen <miles.chen@mediatek.com>
To: <yf.wang@mediatek.com>
Cc: <Libo.Kang@mediatek.com>, <Ning.Li@mediatek.com>,
	<iommu@lists.linux-foundation.org>, <joro@8bytes.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>, <logang@deltatee.com>,
	<matthias.bgg@gmail.com>, <stable@vger.kernel.org>,
	<will@kernel.org>, <wsd_upstream@mediatek.com>,
	<yong.wu@mediatek.com>
Subject: Re: [PATCH] iommu/dma: Fix iova map result check bug
Date: Mon, 9 May 2022 00:01:15 +0800	[thread overview]
Message-ID: <20220508160115.4851-1-miles.chen@mediatek.com> (raw)
In-Reply-To: <20220507085204.16914-1-yf.wang@mediatek.com>

> The data type of the return value of the iommu_map_sg_atomic
> is ssize_t, but the data type of iova size is size_t,
> e.g. one is int while the other is unsigned int.
> 
> When iommu_map_sg_atomic return value is compared with iova size,
> it will force the signed int to be converted to unsigned int, if
> iova map fails and iommu_map_sg_atomic return error code is less
> than 0, then (ret < iova_len) is false, which will to cause not
> do free iova, and the master can still successfully get the iova
> of map fail, which is not expected.
> 
> Therefore, we need to check the return value of iommu_map_sg_atomic
> in two cases according to whether it is less than 0.
> 
> Fixes: ad8f36e4b6b1 ("iommu: return full error code from iommu_map_sg[_atomic]()")
> Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>

Yes, we have to make sure ssize_t >= 0 before comparing ssize_t and size_t.

Reviewed-by: Miles Chen <miles.chen@mediatek.com> 
>
> Cc: <stable@vger.kernel.org> # 5.15.*

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-08 16:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07  8:52 [PATCH] iommu/dma: Fix iova map result check bug yf.wang
2022-05-07  8:52 ` yf.wang
2022-05-07  8:52 ` yf.wang
2022-05-07  8:52 ` yf.wang--- via iommu
2022-05-08 16:01 ` Miles Chen [this message]
2022-05-08 16:01   ` Miles Chen
2022-05-08 16:01   ` Miles Chen
2022-05-08 16:01   ` Miles Chen via iommu
2022-05-09  9:22 ` Robin Murphy
2022-05-09  9:22   ` Robin Murphy
2022-05-09  9:22   ` Robin Murphy
2022-05-09  9:22   ` Robin Murphy
2022-05-12  5:51 ` Yong Wu
2022-05-12  5:51   ` Yong Wu
2022-05-12  5:51   ` Yong Wu
2022-05-12  5:51   ` Yong Wu via iommu
2022-05-13 13:01 ` Joerg Roedel
2022-05-13 13:01   ` Joerg Roedel
2022-05-13 13:01   ` Joerg Roedel
2022-05-13 13:01   ` Joerg Roedel

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=20220508160115.4851-1-miles.chen@mediatek.com \
    --to=miles.chen@mediatek.com \
    --cc=Libo.Kang@mediatek.com \
    --cc=Ning.Li@mediatek.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=logang@deltatee.com \
    --cc=matthias.bgg@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=wsd_upstream@mediatek.com \
    --cc=yf.wang@mediatek.com \
    --cc=yong.wu@mediatek.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 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.