Skip to content

vfio/pci: fix segfault when running without an IOMMU - #70

Open
iomartin wants to merge 1 commit into
SamsungDS:mainfrom
Eideticom:martin/no_iommu
Open

vfio/pci: fix segfault when running without an IOMMU#70
iomartin wants to merge 1 commit into
SamsungDS:mainfrom
Eideticom:martin/no_iommu

Conversation

@iomartin

Copy link
Copy Markdown
Contributor

If IOMMU is disabled, iommu_get_ctx() returns NULL, and then the following line tries to dereference the context, causing a segfault.

@lsgunth

lsgunth commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

I assume this is with a tainted kernel with CONFIG_VFIO_NOIOMMU set?

Might be worth mentioning that in the commit message because "IOMMU disabled" was not immediately obvious to me.

@iomartin

iomartin commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

No, I hit it when I tried to run in a machine that had amd_iommu=off iommu=off in the command line -- naturally it's not supported but should fail gracefully.

If IOMMU is disabled (such as with iommu=off in the cmdline),
iommu_get_ctx() returns NULL, and then the following line tries to
dereference the context, causing a segfault.

Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants