All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Alex Williamson <alex@shazbot.org>,
	Nipun Gupta <nipun.gupta@amd.com>,
	 Nikhil Agarwal <nikhil.agarwal@amd.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	Kevin Tian <kevin.tian@intel.com>,
	 Nathan Chancellor <nathan@kernel.org>,
	kvm@vger.kernel.org, llvm@lists.linux.dev,
	 linux-kernel@vger.kernel.org, Ian Rogers <irogers@google.com>
Subject: [PATCH] vfio/cdx: Fix missing detach_ioas op
Date: Mon, 30 Nov 2026 14:53:58 -0800	[thread overview]
Message-ID: <20261130225358.97751-1-irogers@google.com> (raw)

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>
---
Note: Found using Clang's require_explicit_initialization attribute;
an AI coding assistant helped audit call sites, verify Fixes commits,
and draft the changelog.

 drivers/vfio/cdx/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/vfio/cdx/main.c b/drivers/vfio/cdx/main.c
index 28dc8c825600..8aca3538293d 100644
--- a/drivers/vfio/cdx/main.c
+++ b/drivers/vfio/cdx/main.c
@@ -308,6 +308,7 @@ static const struct vfio_device_ops vfio_cdx_ops = {
 	.bind_iommufd	= vfio_iommufd_physical_bind,
 	.unbind_iommufd	= vfio_iommufd_physical_unbind,
 	.attach_ioas	= vfio_iommufd_physical_attach_ioas,
+	.detach_ioas	= vfio_iommufd_physical_detach_ioas,
 };
 
 static int vfio_cdx_probe(struct cdx_device *cdx_dev)

base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.56.1.839.g22a8290db9-goog


             reply	other threads:[~2026-11-30 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 22:53 Ian Rogers [this message]
2026-11-30 23:02 ` [PATCH] vfio/cdx: Fix missing detach_ioas op sashiko-bot

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=20261130225358.97751-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=alex@shazbot.org \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.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 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.