All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: zhoumin <teczm@foxmail.com>
Cc: <will@kernel.org>, <joro@8bytes.org>, <robin.murphy@arm.com>,
	<jgg@ziepe.ca>, <iommu@lists.linux.dev>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: Skip unlinked duplicate stream nodes on removal
Date: Mon, 21 Sep 2026 11:37:24 -0700	[thread overview]
Message-ID: <arF5ZGuNoa+yTCNj@nvidia.com> (raw)
In-Reply-To: <tencent_4392079B5C29406B923C037A7E66DD338005@qq.com>

On Mon, Sep 21, 2026 at 08:17:27PM +0800, zhoumin wrote:
> A master's firmware stream ID list can contain duplicates, for example
> for PCI devices behind an aliasing bridge. arm_smmu_insert_master()
> accepts these IDs when the existing stream belongs to the same master,
> but does not link the duplicate stream's rb_node into the SID tree.
> 
> Both arm_smmu_remove_master() and the insertion error path nevertheless
> call rb_erase() for every stream in their respective ranges. Erasing a
> zero-initialized, unlinked node can clear the tree root, losing SID to
> master mappings for other devices sharing the SMMU and leaving the tree
> inconsistent for subsequent operations.
> 
> Mark skipped duplicate nodes with RB_CLEAR_NODE() and skip them in both
> removal paths. Set the marker after sorting the stream array, since it
> contains the node's own address. Keep the stream array and num_streams
> unchanged to preserve existing STE, invalidation and single-stream
> feature checks.
> 
> Fixes: b00d24997a11 ("iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated stream ids") 

I submitted a similar fix a while ago:
https://lore.kernel.org/linux-iommu/9136477b9c737a50cecc38f2ee6704a01510169a.1783044582.git.nicolinc@nvidia.com/

I wonder if you really hit the issue or it's just a Sashiko finding?

Nicolin


      reply	other threads:[~2026-09-21 18:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 12:17 [PATCH] iommu/arm-smmu-v3: Skip unlinked duplicate stream nodes on removal zhoumin
2026-09-21 18:37 ` Nicolin Chen [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=arF5ZGuNoa+yTCNj@nvidia.com \
    --to=nicolinc@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=teczm@foxmail.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.