diff options
author | Ihor Matushchak <ihor.matushchak@foobox.net> | 2019-07-02 17:48:18 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-06 19:08:08 +0200 |
commit | 4e4bc0aa7d85d5ca01c86687f8f6f8c43b98b08e (patch) | |
tree | a1fab8c9b186a260a1c2a7eeff7e5c51c362337e | |
parent | 35c1f07ca23370ef65d5c29ed9a02f07e65fbf1b (diff) | |
download | linux-stable-4e4bc0aa7d85d5ca01c86687f8f6f8c43b98b08e.tar.gz linux-stable-4e4bc0aa7d85d5ca01c86687f8f6f8c43b98b08e.tar.bz2 linux-stable-4e4bc0aa7d85d5ca01c86687f8f6f8c43b98b08e.zip |
virtio-mmio: add error check for platform_get_irq
[ Upstream commit 5e663f0410fa2f355042209154029842ba1abd43 ]
in vm_find_vqs() irq has a wrong type
so, in case of no IRQ resource defined,
wrong parameter will be passed to request_irq()
Signed-off-by: Ihor Matushchak <ihor.matushchak@foobox.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ivan T. Ivanov <iivanov.xz@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/virtio/virtio_mmio.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index f363fbeb5ab0..e09edb5c5e06 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -463,9 +463,14 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, struct irq_affinity *desc) { struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); - unsigned int irq = platform_get_irq(vm_dev->pdev, 0); + int irq = platform_get_irq(vm_dev->pdev, 0); int i, err, queue_idx = 0; + if (irq < 0) { + dev_err(&vdev->dev, "Cannot get IRQ resource\n"); + return irq; + } + err = request_irq(irq, vm_interrupt, IRQF_SHARED, dev_name(&vdev->dev), vm_dev); if (err) |