From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796079245; b=XJx4X0paGy4Vm9wyGJUAqdLGPvTB466gz1j5fmzVO0QLM/3LVV7bVC2G+fJPjdIi2QcL K43TW5uX4GKYe7W1CG8UOzeOwtUI/KaUHHNw99Uj/WMMhtl9i7EwYCqqfgp97ei/mT/FY bFJA4YSMJSZ9jlJ0UuzbR6wsBfm1/RGGkZSoeHnkoO0KZQk3owH0xe5P71H18Qkg2cy1s IWaDL/CRH7giGK4OtlxesdMO/yW72hv+ZqNB6VXa4XPr8eNeymCwSeg2cJxtaeizDE/Cg Tlhvi+z7rnEYNHWt/QQtrq2VvbvaZC50i0LT5H2zh16bYGNoP/dvQniYHIjcWZBXbQg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796079245; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=yUsE8TEvtiwPWOhBl53lKJDjKHa9fNK9apiAwce4wvg=; b=HBbZHlqXsFsFf81TAQRgd3NCgtyLSMz2Bn5hw99DBOZbCHHkO5Vdt+2eKKQHqo26BkWa nWo5JEUWl+7CPWpty5sBo6NQPB/q5Ifq43sTMfm/fzxw6Rt9bDPACs8Y1P8uj8kpzP+9f a7GivoutH6KyoZwc5JjPW7BfdnoaHJgdvhcDELnSUYsC0fieYrJpmqCltcskBp/Zoi+ca AZ0i6RBPicRwDsuD1y6JbmnFYwzVdgh4JhIRFLDezegnX8aP4RYiOLi5zr10T0a2Qf9Ei Xc40GbA5Y4q9e5hmb+KYHq6VyB6u/Yf9wzeCd0pX+LGlvyBP3GtyWcni412XKqeY/TQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=YYDhkmmy; arc=none smtp.remote-ip=74.125.82.200 Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C461B606A32A for ; Mon, 30 Nov 2026 22:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C461B606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=YYDhkmmy Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-3854627c1c8so14209365eec.1 for ; Mon, 30 Nov 2026 14:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796079244; x=1796684044; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=yUsE8TEvtiwPWOhBl53lKJDjKHa9fNK9apiAwce4wvg=; b=YYDhkmmyvl1xvSnvf0epnghb0NeKVaEuYBMzW5iobcHzy1Edus45/jFg1m6Vfx0Hc1 pixOid63uA4tsGI6eseGCoo67Jt+4JHEJ4QpDp7Dxn3jb4TVQzgdK8Ahc/JyrrEdnCdO Iskih4Q0OrDvRcFrXnCC+0HUmVgy36ZP0piDgmMzvrUUJqLej0G8iqTY6ardn8gWdscd leX7TXMlRq6okBFPVZNPNc2c3UAjWDO4MkL1ZJ5oJJVN+kw3Ky0pzx7JjZZO3mzgrGqk dlpBMwV3QIge2UN2cJ0X7nC2H9YgJfDOGNCmn/UUOExNq/8XwUFx6xCGnrWTtx64C0sp oudQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796079244; x=1796684044; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yUsE8TEvtiwPWOhBl53lKJDjKHa9fNK9apiAwce4wvg=; b=1hO4OUtbC/Zlkm/h5d68ntrhsO3BLzpJudLrRMyARV1nHQn7I2zoUiCyyKxIWbqx+i RtdMrLbiK7bWSSuitpUOkj3ap7DVNyzjbDcLHd+nISW9RVjhnWDuAy4G8SgyTvnpOjKz 1Rx4f4izaDh7loOfdq2LqRQae/OyF3GXkq4jWTQHNmnh6GasTq7ucwJQijUIrwvigzfK 7BXNnxHbUz6OZPa0D5kYVdBy0mFdOycu+u06oYTRMBdS32pkao2NkdUgxzBUWBUXuds7 i5H76RX5QS+0LXP+rkr21GURIekmVU65eoht54CM96x4ORAWNPBTsZ/k6GJAk/scE0vd Wn+w== X-Forwarded-Encrypted: i=1; AL+hErGxRUz7juTU8qad7vK0k8CRnagp8WOgY9F/roQDu7eq17XZ3Co4pD6xKlM5pF0AJxrPSf+S7K1m6p9Phik=@vger.kernel.org X-Gm-Message-State: APuU4Z9UdmUjNXSaBEGaDx9pjagVwtomNxHAClw2WjZvVnXjJQNoPz8g J7eUzN26GlfRhNpEhJpCgxYNvlSH5LDXyG2auxf7aGXfJt6KI13O7ds3zX5pYsgCGRZDV4563UT JzNPF5jAarg== X-Received: from dycmv4.prod.google.com ([2002:a05:693c:2804:b0:387:16a9:be02]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:e9d9:10b0:386:ce20:31c6 with SMTP id 5a478bee46e88-386ce20334emr21674618eec.29.1796079243729; Mon, 30 Nov 2026 14:54:03 -0800 (PST) Date: Mon, 30 Nov 2026 14:53:58 -0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261130225358.97751-1-irogers@google.com> Subject: [PATCH] vfio/cdx: Fix missing detach_ioas op From: Ian Rogers To: Alex Williamson , Nipun Gupta , Nikhil Agarwal Cc: Jason Gunthorpe , Kevin Tian , Nathan Chancellor , kvm@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" 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 --- 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