Commit 97ee04f
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: 4c3b54a ("virtio_pci_modern: use completion instead of busy loop to wait on admin cmd result")
Signed-off-by: Feng Liu <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Reviewed-by: Parav Pandit <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>1 parent 7f8825b commit 97ee04f
File tree
3 files changed
+20
-17
lines changed- drivers/virtio
3 files changed
+20
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
234 | 244 | | |
235 | 245 | | |
236 | 246 | | |
237 | | - | |
| 247 | + | |
238 | 248 | | |
239 | 249 | | |
240 | | - | |
241 | 250 | | |
242 | 251 | | |
243 | 252 | | |
| |||
258 | 267 | | |
259 | 268 | | |
260 | 269 | | |
| 270 | + | |
261 | 271 | | |
262 | 272 | | |
263 | 273 | | |
264 | 274 | | |
265 | | - | |
266 | | - | |
| 275 | + | |
| 276 | + | |
267 | 277 | | |
| 278 | + | |
| 279 | + | |
268 | 280 | | |
269 | 281 | | |
270 | 282 | | |
| |||
273 | 285 | | |
274 | 286 | | |
275 | 287 | | |
276 | | - | |
| 288 | + | |
277 | 289 | | |
278 | 290 | | |
279 | 291 | | |
| |||
354 | 366 | | |
355 | 367 | | |
356 | 368 | | |
357 | | - | |
| 369 | + | |
358 | 370 | | |
359 | 371 | | |
360 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 46 | | |
57 | 47 | | |
58 | 48 | | |
| |||
245 | 235 | | |
246 | 236 | | |
247 | 237 | | |
248 | | - | |
| 238 | + | |
249 | 239 | | |
250 | 240 | | |
251 | 241 | | |
| |||
0 commit comments