Linux IOMMU Development
 help / color / mirror / Atom feed
From: "Yong Wu (吴勇)" <Yong.Wu@mediatek.com>
To: "joro@8bytes.org" <joro@8bytes.org>,
	"error27@gmail.com" <error27@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"kernelci-results@groups.io" <kernelci-results@groups.io>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"angelogioacchino.delregno@collabora.com"
	<angelogioacchino.delregno@collabora.com>,
	"will@kernel.org" <will@kernel.org>
Subject: Re: [PATCH] iommu/mediatek: Fix forever loop in error handling
Date: Fri, 9 Dec 2022 02:20:36 +0000	[thread overview]
Message-ID: <b28e0163c75e320b2dc1b9fe7007277d1847bb56.camel@mediatek.com> (raw)
In-Reply-To: <68cb1ee26fc61a290a9e69b15234848ec8a02b8c.camel@mediatek.com>

Hi Joerg,

On Thu, 2022-12-08 at 09:06 +0800, YongWu wrote:
> On Wed, 2022-12-07 at 18:56 +0300, Dan Carpenter wrote:
> > There is a typo so this loop does i++ where i-- was intended.  It
> > will
> > result in looping until the kernel crashes.
> > 
> > Fixes: 26593928564c ("iommu/mediatek: Add error path for loop of
> > mm_dts_parse")
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> Sorry for this.
> 
> Reviewed-by: Yong Wu <yong.wu@mediatek.com>
> 
> Thanks Dan.

Could you help apply this?

I reproduced this below issue, and it could be fixed by this patch.

https://lore.kernel.org/linux-mediatek/Y5HrIhEfuEgGKuMB@sirena.org.uk/

Thanks.

> 
> > ---
> >  drivers/iommu/mtk_iommu.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> > index 3e46bc8b0714..2badd6acfb23 100644
> > --- a/drivers/iommu/mtk_iommu.c
> > +++ b/drivers/iommu/mtk_iommu.c
> > @@ -1160,8 +1160,7 @@ static int mtk_iommu_mm_dts_parse(struct
> > device
> > *dev, struct component_match **m
> >  	return 0;
> >  
> >  err_larbdev_put:
> > -	/* id may be not linear mapping, loop whole the array */
> > -	for (i = MTK_LARB_NR_MAX - 1; i >= 0; i++) {
> > +	for (i = MTK_LARB_NR_MAX - 1; i >= 0; i--) {
> >  		if (!data->larb_imu[i].dev)
> >  			continue;
> >  		put_device(data->larb_imu[i].dev);

  reply	other threads:[~2022-12-09  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 15:56 [PATCH] iommu/mediatek: Fix forever loop in error handling Dan Carpenter
2022-12-08  1:06 ` Yong Wu (吴勇)
2022-12-09  2:20   ` Yong Wu (吴勇) [this message]
2022-12-12 11:06 ` 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=b28e0163c75e320b2dc1b9fe7007277d1847bb56.camel@mediatek.com \
    --to=yong.wu@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=error27@gmail.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernelci-results@groups.io \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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