Feng Liu 97ee04feb6 virtio_pci: Fix admin vq cleanup by using correct info pointer
vp_modern_avq_cleanup() and vp_del_vqs() clean up admin vq
resources by virtio_pci_vq_info pointer. The info pointer of admin
vq is stored in vp_dev->admin_vq.info instead of vp_dev->vqs[].
Using the info pointer from vp_dev->vqs[] for admin vq causes a
kernel NULL pointer dereference bug.
In vp_modern_avq_cleanup() and vp_del_vqs(), get the info pointer
from vp_dev->admin_vq.info for admin vq to clean up the resources.
Also make info ptr as argument of vp_del_vq() to be symmetric with
vp_setup_vq().

vp_reset calls vp_modern_avq_cleanup, and causes the Call Trace:
==================================================================
BUG: kernel NULL pointer dereference, address:0000000000000000
...
CPU: 49 UID: 0 PID: 4439 Comm: modprobe Not tainted 6.11.0-rc5 #1
RIP: 0010:vp_reset+0x57/0x90 [virtio_pci]
Call Trace:
 <TASK>
...
 ? vp_reset+0x57/0x90 [virtio_pci]
 ? vp_reset+0x38/0x90 [virtio_pci]
 virtio_reset_device+0x1d/0x30
 remove_vq_common+0x1c/0x1a0 [virtio_net]
 virtnet_remove+0xa1/0xc0 [virtio_net]
 virtio_dev_remove+0x46/0xa0
...
 virtio_pci_driver_exit+0x14/0x810 [virtio_pci]
==================================================================

Fixes: 4c3b54af907e ("virtio_pci_modern: use completion instead of busy loop to wait on admin cmd result")
Signed-off-by: Feng Liu <feliu@nvidia.com>
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Message-Id: <20241024135406.81388-1-feliu@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-11-06 04:40:07 -05:00
..
2024-11-03 08:51:53 -10:00
2024-10-18 15:53:00 -07:00
2024-09-27 08:48:37 -07:00
2024-10-29 00:46:20 +02:00
2024-09-17 15:27:01 +02:00
2024-09-18 10:49:45 +02:00
2024-11-03 10:15:50 -10:00
2024-09-19 10:18:15 +02:00
2024-11-01 07:54:11 -10:00
2024-11-02 04:44:27 +10:00
2024-10-24 16:31:58 -07:00
2024-09-19 10:18:15 +02:00
2024-10-05 10:31:04 -07:00
2024-11-03 08:35:29 -10:00
2024-10-27 08:29:36 -10:00
2024-09-29 09:22:34 -07:00
2024-10-29 04:01:40 +01:00
2024-10-11 11:23:21 -07:00
2024-09-26 08:43:17 -07:00
2024-11-01 13:41:55 -10:00
2024-11-01 15:44:23 -10:00
2024-10-27 08:40:33 -10:00
2024-09-26 12:00:25 -07:00
2024-10-30 08:16:23 -10:00
2024-10-11 10:03:13 +00:00
2024-10-19 12:52:19 -07:00
2024-09-09 12:22:06 +02:00
2024-10-30 08:16:23 -10:00
2024-09-11 16:02:54 +02:00
2024-10-07 11:33:26 -07:00
2024-09-04 17:24:58 -05:00