Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH AUTOSEL 6.18-6.1] vdpa: alibaba: add missing MODULE_DEVICE_TABLE()
Date: Mon, 19 Oct 2026 14:49:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-177512@kernel.org> (raw)
In-Reply-To: <20261019135441.1420968-253-sashal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] vdpa: alibaba: exporting generic virtio-net PCI ID breaks virtio_pci binding
--

commit 56e367c85e2f18386c5a07775af8ff1e3da0457f
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>

vdpa: alibaba: add missing MODULE_DEVICE_TABLE()

This commit adds MODULE_DEVICE_TABLE(pci, eni_pci_ids) to the Alibaba ENI
vDPA driver so that PCI module alias entries are generated for automatic
module loading.

> diff --git a/drivers/vdpa/alibaba/eni_vdpa.c b/drivers/vdpa/alibaba/eni_vdpa.c
> index e476504db0c82..fd6fdba460945 100644
> --- a/drivers/vdpa/alibaba/eni_vdpa.c
> +++ b/drivers/vdpa/alibaba/eni_vdpa.c
> @@ -545,6 +545,7 @@ static struct pci_device_id eni_pci_ids[] = {
>  			 VIRTIO_ID_NET) },
>  	{ 0 },
>  };
> +MODULE_DEVICE_TABLE(pci, eni_pci_ids);
>  
>  static struct pci_driver eni_vdpa_driver = {
>  	.name		= "alibaba-eni-vdpa",

[Severity: High]
Will exporting eni_pci_ids via MODULE_DEVICE_TABLE() cause eni_vdpa to
auto-load on standard non-Alibaba x86 VMs and race with virtio_pci for
generic transitional or legacy virtio-net PCI devices?

In drivers/vdpa/alibaba/eni_vdpa.c, eni_pci_ids matches the generic
Virtio 0.9.5 / transitional Virtio 1.0 network device IDs rather than an
Alibaba-specific PCI ID:

drivers/vdpa/alibaba/eni_vdpa.c:
static struct pci_device_id eni_pci_ids[] = {
	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_REDHAT_QUMRANET,
			 VIRTIO_TRANS_ID_NET,
			 PCI_SUBVENDOR_ID_REDHAT_QUMRANET,
			 VIRTIO_ID_NET) },
	{ 0 },
};

These are the same PCI IDs (vendor 0x1af4, device 0x1000, subvendor
0x1af4, subdevice 0x0001) exposed by default virtio-net-pci devices in
QEMU/KVM and matched by virtio_pci_id_table in
drivers/virtio/virtio_pci_common.c:

static const struct pci_device_id virtio_pci_id_table[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_ANY_ID) },
	{ 0 }
};
MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);

Previously, omitting MODULE_DEVICE_TABLE() prevented eni_vdpa from
publishing a modalias for 1af4:1000, so it was only loaded when explicitly
requested by userspace on Alibaba instances. With MODULE_DEVICE_TABLE()
added, udev/kmod will auto-load eni_vdpa on any x86 guest with a
transitional or legacy virtio-net-pci device when CONFIG_ALIBABA_ENI_VDPA=m
and CONFIG_VIRTIO_PCI=m.

In eni_vdpa_probe(), there is no hardware check distinguishing an Alibaba
ENI device from a standard QEMU virtio-net-pci device:

drivers/vdpa/alibaba/eni_vdpa.c:eni_vdpa_probe() {
    ...
	ldev = &eni_vdpa->ldev;
	ldev->pci_dev = pdev;

	ret = vp_legacy_probe(ldev);
	if (ret) {
		ENI_ERR(pdev, "failed to probe legacy PCI device\n");
		goto err;
	}
    ...
}

If eni_vdpa probes the PCI device before virtio_pci, eni_vdpa_probe() ->
vp_legacy_probe() succeeds and claims the device into the vDPA subsystem
via vdpa_register_device(), preventing virtio_pci from binding and causing
the guest to lose its standard virtio_net network interface.

Was MODULE_DEVICE_TABLE() intentionally omitted here to avoid hijacking
generic legacy/transitional virtio-net PCI devices from virtio_pci?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019135441.1420968-253-sashal@kernel.org?part=1

  reply	other threads:[~2026-10-19 14:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261019135441.1420968-1-sashal@kernel.org>
2026-10-19 13:47 ` [PATCH AUTOSEL 6.18-5.15] virtio_ring: fix infinite loop in virtnet_poll_cleantx when device is broken Sasha Levin
2026-10-19 14:25   ` sashiko-bot
2026-10-19 13:47 ` [PATCH AUTOSEL 6.18-6.6] vdpa_sim: hold iommu_lock across dma_unmap passthrough transition Sasha Levin
2026-10-19 14:29   ` sashiko-bot
2026-10-19 13:47 ` [PATCH AUTOSEL 6.18-6.1] drm/virtio: reclaim pending vbufs before tearing down vqs Sasha Levin
2026-10-19 14:51   ` sashiko-bot
2026-10-19 13:49 ` [PATCH AUTOSEL 6.18-6.1] vdpa: alibaba: add missing MODULE_DEVICE_TABLE() Sasha Levin
2026-10-19 14:49   ` sashiko-bot [this message]
2026-10-19 13:49 ` [PATCH AUTOSEL 6.18-6.12] vdpa: octeon_ep: " Sasha Levin
2026-10-19 14:50   ` sashiko-bot
2026-10-19 13:50 ` [PATCH AUTOSEL 6.18-5.10] virtio_console: take a kref in find_port_by_vq() to fix port UAF Sasha Levin
2026-10-19 15:00   ` sashiko-bot
2026-10-19 13:50 ` [PATCH AUTOSEL 6.18-5.10] virtio_balloon: warn on failed buffer add in tell_host() Sasha Levin
2026-10-19 14:59   ` sashiko-bot
2026-10-19 13:51 ` [PATCH AUTOSEL 6.18-5.10] virtio_console: fix control queue race during restore Sasha Levin
2026-10-19 15:11   ` sashiko-bot
2026-10-19 13:51 ` [PATCH AUTOSEL 6.18] drm/virtio: abort virtqueue wait on device removal to avoid hung task Sasha Levin
2026-10-19 15:24   ` sashiko-bot
2026-10-19 13:52 ` [PATCH AUTOSEL 6.18-6.12] vdpa/mlx5: roll back MR update after VQ setup failure Sasha Levin
2026-10-19 15:17   ` 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=sashiko-outbox-177512@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=sashal@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@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