From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.199 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796079245; b=p3VCHcW3IhJv6xlECZH9DWtqZ2IIx+qpJh9hgAde5kzwy2PBg+AKYGD/+gmMPx+mFxOd MlUFbaknl7vPxaogaW+PYJT4182RsbzLAYk0M+StFEPfBIsdRcfhJ2+aDK4Ut2GHtpkoY Zvkzkpl/NM/1n8A+8tbPpKtNk2bc5ccVhZn+zgZtemyx2r3GX3n0aTOiXLasQaexAmWxZ B36H7fxC2l8GeLYzHIvaU9sGu4yQG8cBUMzNg8KNv17CPm1dG50J/VquU5ZkK4qLbJzVs bFZonKrEAZjLHe2uxHShcyIfNyayiq7+2rceBsPjICcLcsalweL5Emtbkap3S6WoRkw== 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=z3BCMTDtTjHmzMTLCuAHIDkvv9l/4LPZQhGO0pAWcSUgnxvJyj+V7Yii+cnX2HlfNThd dD9wQgzRzDDZqMo1q2nGDCHBt0be98eTIY4H3mg1ktKfEtZYMzm6TvCsodKfHONgsVXsK +YxqgZhJ0NutnDF+3kFN50c6sfkoziD84vHOZb+WPGdoL8sq7aANmMH4wB/zN8D1Jp9p9 gdQ6lJbH/oCiels0/16Ort7ft3tGyE53x931BY5xU05xVNkX4FzLm9w+O+M5/3gkNDXyK 4iDoc6gZ0OK6vHEa4CZuz4+PLlmqlUCDLX1vbwLlAS2GMfu0RkZlb6utmkcNzcwKbXw== 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=ovt26owW; arc=none smtp.remote-ip=74.125.82.199 Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) (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 B0ADE606A320 for ; Mon, 30 Nov 2026 22:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B0ADE606A320 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=ovt26owW Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-386a65fca25so10593101eec.0 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=lists.linux.dev; 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=ovt26owWJ/gvWWJknIipVlfXTu9iKzZVCxcGpekgXl5vvqSzcAn9CkALTYU/t3fcCJ TTZiiR8OcGGrctuaQ0bFDQw9TjPTN/guakXQOZvoFPgDv3VAwHPxUxnQ4zKlTUUpcHl8 y5PiicxpU6Tf7K6HxFKt6iUrbuskQ4m4vPy3iwWG2aEsZVHCha8zVyFp8OYQyfbe3uE7 sdSxeH5LbaUcIX8jEEEVCVWr/h13B5qZr9sMEq5aPzu0LxDlE/e5x3KWrBLtFJkW5css mgMGXW2whiS5G4XJsle+ESMzCnqP8LXeqRDqFe6SXCCyRa6inwGkgE1rcZsX5xJzrqnx QO8Q== 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=IMXnJ5sfk1Y8vwZBhfkW5rGgvDzLEs6iwZxpWDggbQIzEGD7B+VwJN8nFD+zvt6rT4 HrjRJlhhbgALmBekyOytRZLZwEc756hD/QxsghaTkVktsfw+ZuMRP/bYqzzt3ruks1HW RaWDgqA1QFYNT7Th8QS5asYnyzIfg8NoOgGZLV+DhaNRAp+L1hxSxCOb8eHnZpXyYEvK zuH3mwNQv2b/hM2XX8bwK8HjhzjzCB+gSCkp08TaEifsWW6sxwLaFG4mXCA++nGnLmSr UXJZZ1DPQRGJLfhqw752IwJ4tgFp7qPCRqs7iGIAcUdr0BfkESRfHCXbbmA6wbdHE1p8 PH8w== X-Forwarded-Encrypted: i=1; AL+hErHfk493x12ku7POWdV9C6d4NZ3x4Y1kI5LtCgz/QWgCR2ryMKh2CnIkupj4a8lcqZTZ1uHC@lists.linux.dev X-Gm-Message-State: APuU4Z8UckHSCTAXoiPl4kzqmGATK9KFnB9kKmy/RyhrtezugUwp30Ku CZb1l/5FdNyzPxJipO3jJ5qc/qk7bUF0LtVXW0euiSMaMq322DwlpsQs7LGoNBVqvwoGqO/J+gW /shKcBiOhqg== 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: llvm@lists.linux.dev 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