From: Will Deacon <will@kernel.org>
To: yf.wang@mediatek.com
Cc: Robin Murphy <robin.murphy@arm.com>,
Joerg Roedel <joro@8bytes.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
"moderated list:ARM SMMU DRIVERS"
<linux-arm-kernel@lists.infradead.org>,
"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
open list <linux-kernel@vger.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
wsd_upstream@mediatek.com, Libo Kang <Libo.Kang@mediatek.com>,
Yong Wu <Yong.Wu@mediatek.com>,
Guangming Cao <Guangming.Cao@mediatek.com>
Subject: Re: [PATCH] iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure
Date: Tue, 7 Dec 2021 09:48:18 +0000 [thread overview]
Message-ID: <20211207094817.GA31382@willie-the-truck> (raw)
In-Reply-To: <20211207024723.25751-1-yf.wang@mediatek.com>
On Tue, Dec 07, 2021 at 10:47:22AM +0800, yf.wang@mediatek.com wrote:
> From: Yunfei Wang <yf.wang@mediatek.com>
>
> In __arm_v7s_alloc_table function:
> iommu call kmem_cache_alloc to allocate page table, this function
> allocate memory may fail, when kmem_cache_alloc fails to allocate
> table, call virt_to_phys will be abnomal and return unexpected phys
> and goto out_free, then call kmem_cache_free to release table will
> trigger KE, __get_free_pages and free_pages have similar problem,
> so add error handle for page table allocation failure.
>
> Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
> ---
> drivers/iommu/io-pgtable-arm-v7s.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
> index bfb6acb651e5..d84240308f4b 100644
> --- a/drivers/iommu/io-pgtable-arm-v7s.c
> +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> @@ -246,6 +246,12 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
> __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size));
> else if (lvl == 2)
> table = kmem_cache_zalloc(data->l2_tables, gfp);
> +
> + if (!table) {
> + dev_err(dev, "Page table allocation failure lvl:%d\n", lvl);
I'd expect the allocator to shout loudly on failure anyway, so I don't think
we need to print another message here.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next parent reply other threads:[~2021-12-07 10:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211207024723.25751-1-yf.wang@mediatek.com>
2021-12-07 9:48 ` Will Deacon [this message]
[not found] ` <20211207113315.29109-1-yf.wang@mediatek.com>
2021-12-07 11:42 ` [PATCH v3] iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure Robin Murphy
2021-12-14 15:18 ` Will Deacon
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=20211207094817.GA31382@willie-the-truck \
--to=will@kernel.org \
--cc=Guangming.Cao@mediatek.com \
--cc=Libo.Kang@mediatek.com \
--cc=Yong.Wu@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=matthias.bgg@gmail.com \
--cc=robin.murphy@arm.com \
--cc=wsd_upstream@mediatek.com \
--cc=yf.wang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox