]> git.baikalelectronics.ru Git - kernel.git/commit
vhost_vdpa: fix the missing irq_bypass_unregister_producer() invocation
authorGautam Dawar <gdawar.xilinx@gmail.com>
Wed, 24 Feb 2021 11:48:45 +0000 (17:18 +0530)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 14 Mar 2021 08:37:36 +0000 (04:37 -0400)
commite549776bede5bb6263b47c7f21521035d843be48
tree8407407036a3c1dd3bae520d2c9517fcd10f6eb2
parent88d08d6b233225c4fde246cff4a2513369c98818
vhost_vdpa: fix the missing irq_bypass_unregister_producer() invocation

When qemu with vhost-vdpa netdevice is run for the first time,
it works well. But after the VM is powered off, the next qemu run
causes kernel panic due to a NULL pointer dereference in
irq_bypass_register_producer().

When the VM is powered off, vhost_vdpa_clean_irq() misses on calling
irq_bypass_unregister_producer() for irq 0 because of the existing check.

This leaves stale producer nodes, which are reset in
vhost_vring_call_reset() when vhost_dev_init() is invoked during the
second qemu run.

As the node member of struct irq_bypass_producer is also initialized
to zero, traversal on the producers list causes crash due to NULL
pointer dereference.

Fixes: e7056aa9bacdc ("vhost_vdpa: implement IRQ offloading in vhost_vdpa")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=211711
Signed-off-by: Gautam Dawar <gdawar.xilinx@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210224114845.104173-1-gdawar.xilinx@gmail.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vdpa.c