Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] vfio/cdx: Fix missing detach_ioas op
Date: Mon, 30 Nov 2026 23:02:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-242183@kernel.org> (raw)
In-Reply-To: <20261130225358.97751-1-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] vfio/cdx: wrong Fixes tag and inaccurate failure description in
  commit message
--

commit 7a52ebc6a229b6078a67382f6b46211cab2d89fe
Author: Ian Rogers <irogers@google.com>

> vfio/cdx: Fix missing detach_ioas op
>
> vfio_cdx_ops sets bind_iommufd, unbind_iommufd, and attach_ioas to the
> vfio_iommufd_physical_* helpers, but omits detach_ioas. Both
> vfio_df_ioctl_detach_pt() and the error path in
> vfio_df_ioctl_attach_pt() invoke device->ops->detach_ioas(device)
> unconditionally, causing a NULL pointer dereference if an IOAS is
> detached on a VFIO CDX cdev.
>
> Add the missing vfio_iommufd_physical_detach_ioas callback, found with
> Clang's require_explicit_initialization attribute.
>
> Fixes: 234489ac5613 ("vfio/cdx: add support for CDX bus")
> Signed-off-by: Ian Rogers <irogers@google.com>

[Severity: Low]
Should the Fixes tag reference 9048c7341c4d ("vfio-iommufd: Add detach_ioas
support for physical VFIO devices") instead?  At 234489ac5613 ("vfio/cdx:
add support for CDX bus"), struct vfio_device_ops did not have a
detach_ioas callback; 9048c7341c4d ("vfio-iommufd: Add detach_ioas support
for physical VFIO devices") added detach_ioas and wired up
vfio_iommufd_physical_detach_ioas() across the other physical VFIO drivers
while omitting vfio_cdx_ops.

Also, is the NULL pointer dereference description in the commit message
reachable?  When CONFIG_IOMMUFD is enabled, __vfio_register_dev() checks
!device->ops->detach_ioas and fails registration with WARN_ON() and -EINVAL
during vfio_cdx_probe() -> vfio_register_group_dev(), before a cdev can be
exposed or vfio_df_ioctl_attach_pt() and vfio_df_ioctl_detach_pt() can run.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130225358.97751-1-irogers@google.com?part=1

      reply	other threads:[~2026-11-30 23:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 22:53 [PATCH] vfio/cdx: Fix missing detach_ioas op Ian Rogers
2026-11-30 23:02 ` sashiko-bot [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=sashiko-outbox-242183@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox