Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vhost: move vdpa group bound check to vhost_vdpa

Remove duplication by consolidating these here. This reduces the
posibility of a parent driver missing them.

While we're at it, fix a bug in vdpa_sim where a valid ASID can be
assigned to a group equal to ngroups, causing an out of bound write.

Cc: stable@vger.kernel.org
Fixes: bda324fd037a ("vdpasim: control virtqueue support")
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260119143306.1818855-2-eperezma@redhat.com>

authored by

Eugenio Pérez and committed by
Michael S. Tsirkin
cd025c1e 74bc5f69

+1 -10
-3
drivers/vdpa/mlx5/net/mlx5_vnet.c
··· 3640 3640 struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); 3641 3641 int err = 0; 3642 3642 3643 - if (group >= MLX5_VDPA_NUMVQ_GROUPS) 3644 - return -EINVAL; 3645 - 3646 3643 mvdev->mres.group2asid[group] = asid; 3647 3644 3648 3645 mutex_lock(&mvdev->mres.lock);
-6
drivers/vdpa/vdpa_sim/vdpa_sim.c
··· 606 606 struct vhost_iotlb *iommu; 607 607 int i; 608 608 609 - if (group > vdpasim->dev_attr.ngroups) 610 - return -EINVAL; 611 - 612 - if (asid >= vdpasim->dev_attr.nas) 613 - return -EINVAL; 614 - 615 609 iommu = &vdpasim->iommu[asid]; 616 610 617 611 mutex_lock(&vdpasim->mutex);
+1 -1
drivers/vhost/vdpa.c
··· 680 680 case VHOST_VDPA_SET_GROUP_ASID: 681 681 if (copy_from_user(&s, argp, sizeof(s))) 682 682 return -EFAULT; 683 - if (s.num >= vdpa->nas) 683 + if (idx >= vdpa->ngroups || s.num >= vdpa->nas) 684 684 return -EINVAL; 685 685 if (!ops->set_group_asid) 686 686 return -EOPNOTSUPP;