From: "Jörg Rödel" <joro@8bytes.org>
To: Wanhui Fu <fuwh1120@163.com>
Cc: will@kernel.org, robin.murphy@arm.com, jroedel@suse.de,
iommu@lists.linux.dev
Subject: Re: [PATCH] iommu/pamu: Free slab caches in pamu_domain_init()
Date: Mon, 30 Nov 2026 10:49:27 +0100 [thread overview]
Message-ID: <aw1Gcg-Rt9ML6oah@8bytes.org> (raw)
In-Reply-To: <20261126085926.3866382-1-fuwh1120@163.com>
On Thu, Nov 26, 2026 at 04:59:26PM +0800, Wanhui Fu wrote:
> iommu_init_mempool() allocates two slab caches. Destroy both
> caches on later error paths to avoid leaking resources when
> initialization fails.
>
> Fixes: 3ff2dcc05894 ("iommu/pamu: Fix PAMU boot crash")
> Signed-off-by: Wanhui Fu <fuwh1120@163.com>
Applied, thanks. Please consider my inline comment for a follow-on patch.
> ---
> drivers/iommu/fsl_pamu_domain.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
> index 9664ef9840d2..683bf005a3a2 100644
> --- a/drivers/iommu/fsl_pamu_domain.c
> +++ b/drivers/iommu/fsl_pamu_domain.c
> @@ -449,12 +449,17 @@ int __init pamu_domain_init(void)
> return ret;
>
> ret = iommu_device_sysfs_add(&pamu_iommu, NULL, NULL, "iommu0");
> - if (ret)
> + if (ret) {
> + kmem_cache_destroy(iommu_devinfo_cache);
> + kmem_cache_destroy(fsl_pamu_domain_cache);
> return ret;
> + }
>
> ret = iommu_device_register(&pamu_iommu, &fsl_pamu_ops, NULL);
> if (ret) {
> iommu_device_sysfs_remove(&pamu_iommu);
> + kmem_cache_destroy(iommu_devinfo_cache);
> + kmem_cache_destroy(fsl_pamu_domain_cache);
> pr_err("Can't register iommu device\n");
> }
This looks like it deserves a common failure path to get rid of the
duplication.
-Joerg
next prev parent reply other threads:[~2026-11-30 9:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 8:59 [PATCH] iommu/pamu: Free slab caches in pamu_domain_init() Wanhui Fu
2026-11-30 9:49 ` Jörg Rödel [this message]
2026-11-30 14:43 ` fuwh1120
2026-11-30 18:40 ` Jörg Rödel
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=aw1Gcg-Rt9ML6oah@8bytes.org \
--to=joro@8bytes.org \
--cc=fuwh1120@163.com \
--cc=iommu@lists.linux.dev \
--cc=jroedel@suse.de \
--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 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.