All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jianfeng Liu" <liujianfeng1994@gmail.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH v1 1/2] iommu: export iommu_get_dma_domain()
Date: Mon, 28 Sep 2026 05:48:06 +0000	[thread overview]
Message-ID: <20260928054807.2C1A91F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260928053901.7270-2-liujianfeng1994@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] iommu: architectural violation bypassing DMA API and dma-buf isolation
- [Medium] iommu: missing NULL check in exported iommu_get_dma_domain()
- [Low] iommu: missing fallback stub for iommu_get_dma_domain()
--

commit 9558776a7b7367aa853a5851fe8a04b46536b527
Author: Jianfeng Liu <liujianfeng1994@gmail.com>

iommu: export iommu_get_dma_domain()

This commit exports iommu_get_dma_domain() to allow modular drivers to recover
the physical address behind a DMA address for imported dma-bufs.

> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index cd1bca7ede9af..330f9a79248bd 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -2327,6 +2327,7 @@ struct iommu_domain *iommu_get_dma_domain(struct device *dev)
>  {
>  	return dev->iommu_group->default_domain;

[Severity: Medium]
Does this code introduce a regression where modular callers could trigger a
kernel panic? An unconditional dereference of dev->iommu_group will crash
if the passed device does not have an IOMMU group, which can occur with
SWIOTLB fallbacks or missing bindings.

>  }
> +EXPORT_SYMBOL_GPL(iommu_get_dma_domain);

[Severity: High]
Can exporting this function lead to memory corruption by breaking DMA API
and dma-buf isolation? By allowing callers to reverse-translate IOVAs via
iommu_iova_to_phys(), it bypasses the opacity of the DMA mapping API. This
specifically defeats CONFIG_DMABUF_DEBUG (which zeroes struct page
pointers to catch this abuse) and could be dangerous if the DMA API uses
SWIOTLB bounce buffers or dynamic deferred TLB invalidation.

[Severity: Low]
Will this cause build regressions for configs lacking CONFIG_IOMMU_API?
Since the function is now exported for general modular use, any caller
built without CONFIG_IOMMU_API will fail to link or compile because
include/linux/iommu.h lacks a corresponding empty stub in the
!CONFIG_IOMMU_API block.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260928053901.7270-1-liujianfeng1994@gmail.com?part=1

  reply	other threads:[~2026-09-28  5:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  5:38 [PATCH v1 0/2] drm/msm: followup - map page-less imported sg_tables Jianfeng Liu
2026-09-28  5:38 ` [PATCH v1 1/2] iommu: export iommu_get_dma_domain() Jianfeng Liu
2026-09-28  5:48   ` sashiko-bot [this message]
2026-09-28 11:26   ` Robin Murphy
2026-09-29  3:28     ` Jianfeng Liu
2026-09-28  5:38 ` [PATCH v1 2/2] drm/msm: map page-less imported sg_tables from their DMA addresses Jianfeng Liu
2026-09-28  5:52   ` sashiko-bot
2026-09-28 10:09   ` Christian König
2026-09-29  3:27     ` Jianfeng Liu

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=20260928054807.2C1A91F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=liujianfeng1994@gmail.com \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.