Revert "virtio_pci: fix out of bound access for msix_names"
This reverts commitde85ec8b07
. Follow-up patches will revert07ec51480b
("virtio_pci: use shared interrupts for virtqueues") that triggered the problem so no need for this one anymore. Tested-by: Mike Galbraith <efault@gmx.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
404a5c392d
commit
8f10d0149f
|
@ -147,7 +147,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
|
||||||
{
|
{
|
||||||
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
||||||
const char *name = dev_name(&vp_dev->vdev.dev);
|
const char *name = dev_name(&vp_dev->vdev.dev);
|
||||||
int i, j, err = -ENOMEM, allocated_vectors, nvectors;
|
int i, err = -ENOMEM, allocated_vectors, nvectors;
|
||||||
unsigned flags = PCI_IRQ_MSIX;
|
unsigned flags = PCI_IRQ_MSIX;
|
||||||
bool shared = false;
|
bool shared = false;
|
||||||
u16 msix_vec;
|
u16 msix_vec;
|
||||||
|
@ -212,7 +212,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
|
||||||
if (!vp_dev->msix_vector_map)
|
if (!vp_dev->msix_vector_map)
|
||||||
goto out_disable_config_irq;
|
goto out_disable_config_irq;
|
||||||
|
|
||||||
allocated_vectors = j = 1; /* vector 0 is the config interrupt */
|
allocated_vectors = 1; /* vector 0 is the config interrupt */
|
||||||
for (i = 0; i < nvqs; ++i) {
|
for (i = 0; i < nvqs; ++i) {
|
||||||
if (!names[i]) {
|
if (!names[i]) {
|
||||||
vqs[i] = NULL;
|
vqs[i] = NULL;
|
||||||
|
@ -236,19 +236,18 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(vp_dev->msix_names[j],
|
snprintf(vp_dev->msix_names[i + 1],
|
||||||
sizeof(*vp_dev->msix_names), "%s-%s",
|
sizeof(*vp_dev->msix_names), "%s-%s",
|
||||||
dev_name(&vp_dev->vdev.dev), names[i]);
|
dev_name(&vp_dev->vdev.dev), names[i]);
|
||||||
err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec),
|
err = request_irq(pci_irq_vector(vp_dev->pci_dev, msix_vec),
|
||||||
vring_interrupt, IRQF_SHARED,
|
vring_interrupt, IRQF_SHARED,
|
||||||
vp_dev->msix_names[j], vqs[i]);
|
vp_dev->msix_names[i + 1], vqs[i]);
|
||||||
if (err) {
|
if (err) {
|
||||||
/* don't free this irq on error */
|
/* don't free this irq on error */
|
||||||
vp_dev->msix_vector_map[i] = VIRTIO_MSI_NO_VECTOR;
|
vp_dev->msix_vector_map[i] = VIRTIO_MSI_NO_VECTOR;
|
||||||
goto out_remove_vqs;
|
goto out_remove_vqs;
|
||||||
}
|
}
|
||||||
vp_dev->msix_vector_map[i] = msix_vec;
|
vp_dev->msix_vector_map[i] = msix_vec;
|
||||||
j++;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use a different vector for each queue if they are available,
|
* Use a different vector for each queue if they are available,
|
||||||
|
|
Loading…
Reference in New Issue