From: Gaurav Batra <gbatra@linux.ibm.com>
To: Haoxiang Li <haoxiang_li2024@163.com>,
maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
chleroy@kernel.org, kees@kernel.org
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] powerpc/pseries/iommu: Add check for iommu_pseries_alloc_group()
Date: Wed, 24 Jun 2026 10:14:28 -0500 [thread overview]
Message-ID: <436eeb18-1412-450f-a259-25356ddf80d1@linux.ibm.com> (raw)
In-Reply-To: <20260623142918.2287696-1-haoxiang_li2024@163.com>
looks good
Reviewed-by: Gaurav Batra <gbatra@linux.ibm.com>
On 6/23/26 9:29 AM, Haoxiang Li wrote:
> Add check for the return value of iommu_pseries_alloc_group()
> to prevent potential null pointer dereferences.
>
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> - Changes in v2:
> - Add check for other callsites. Thanks, Gaurav!
> ---
> arch/powerpc/platforms/pseries/iommu.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
> index 3e1f915fe4f6..d97bde96dd4d 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -684,6 +684,9 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
> pci->phb->dma_window_base_cur = 0x8000000ul;
>
> pci->table_group = iommu_pseries_alloc_group(pci->phb->node);
> + if (!pci->table_group)
> + return;
> +
> tbl = pci->table_group->tables[0];
>
> iommu_table_setparms(pci->phb, dn, tbl);
> @@ -872,6 +875,9 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
>
> if (!ppci->table_group) {
> ppci->table_group = iommu_pseries_alloc_group(ppci->phb->node);
> + if (!ppci->table_group)
> + return;
> +
> tbl = ppci->table_group->tables[0];
>
> iommu_table_setparms_common(tbl, ppci->phb->bus->number,
> @@ -909,6 +915,9 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
>
> pr_debug(" --> first child, no bridge. Allocating iommu table.\n");
> PCI_DN(dn)->table_group = iommu_pseries_alloc_group(phb->node);
> + if (!PCI_DN(dn)->table_group)
> + return;
> +
> tbl = PCI_DN(dn)->table_group->tables[0];
> iommu_table_setparms(phb, dn, tbl);
>
> @@ -1875,6 +1884,9 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
> pci = PCI_DN(pdn);
> if (!pci->table_group) {
> pci->table_group = iommu_pseries_alloc_group(pci->phb->node);
> + if (!pci->table_group)
> + return;
> +
> tbl = pci->table_group->tables[0];
>
> iommu_table_setparms_common(tbl, pci->phb->bus->number,
prev parent reply other threads:[~2026-06-24 15:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 14:29 [PATCH v2] powerpc/pseries/iommu: Add check for iommu_pseries_alloc_group() Haoxiang Li
2026-06-24 15:14 ` Gaurav Batra [this message]
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=436eeb18-1412-450f-a259-25356ddf80d1@linux.ibm.com \
--to=gbatra@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=haoxiang_li2024@163.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.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