From: Maoyi Xie <maoyixie.tju@gmail.com>
To: joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, jpb@kernel.org
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
virtualization@lists.linux.dev,
Maoyi Xie <maoyixie.tju@gmail.com>
Subject: [PATCH 0/2] iommu: avoid using list iterators past the loop in resv region insertion
Date: Thu, 4 Jun 2026 13:18:14 +0800 [thread overview]
Message-ID: <20260604051816.2976221-1-maoyixie.tju@gmail.com> (raw)
In-Reply-To: <CAHPEe=G-FZvEXjkE+vAXN5MHXCtsOaUoKwg2RQL6m=om+c20hQ@mail.gmail.com>
This follows up the inquiry at [1], where Will and Robin agreed that the
two list iterator sites in drivers/iommu/ that run past the loop end are
worth fixing.
Both loops only walk a list to find a list_head to insert before, not to
operate on the entries. Per Robin's suggestion, rather than tracking an
explicit insert_before pointer, each loop now iterates with list_for_each()
and keeps the list_entry() dereference inside the loop body. There is no
functional change in either patch.
[1] https://lore.kernel.org/all/CAHPEe=G-FZvEXjkE+vAXN5MHXCtsOaUoKwg2RQL6m=om+c20hQ@mail.gmail.com/
Maoyi Xie (2):
iommu: Avoid using the list iterator past the loop in
iommu_insert_resv_region()
iommu/virtio: Avoid using the list iterator past the loop in
viommu_add_resv_mem()
drivers/iommu/iommu.c | 7 +++++--
drivers/iommu/virtio-iommu.c | 10 +++++++---
2 files changed, 12 insertions(+), 5 deletions(-)
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
--
2.34.1
next prev parent reply other threads:[~2026-06-04 5:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 18:49 iommu: iterator used after loop end in resv region insertion? Maoyi Xie
2026-06-02 10:28 ` Will Deacon
2026-06-02 10:44 ` Robin Murphy
2026-06-04 5:18 ` Maoyi Xie [this message]
2026-06-04 5:18 ` [PATCH 1/2] iommu: Avoid using the list iterator past the loop in iommu_insert_resv_region() Maoyi Xie
2026-06-04 5:18 ` [PATCH 2/2] iommu/virtio: Avoid using the list iterator past the loop in viommu_add_resv_mem() Maoyi Xie
2026-06-04 16:04 ` Jean-Philippe Brucker
2026-06-05 8:59 ` Maoyi Xie
2026-06-05 10:01 ` Jean-Philippe Brucker
2026-06-05 10:05 ` Robin Murphy
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=20260604051816.2976221-1-maoyixie.tju@gmail.com \
--to=maoyixie.tju@gmail.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=jpb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=virtualization@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox