Commit 36e493d
vhost-scsi: Handle vhost_vq_work_queue failures for events
[ Upstream commit b1b2ce5 ]
Currently, we can try to queue an event's work before the vhost_task is
created. When this happens we just drop it in vhost_scsi_do_plug before
even calling vhost_vq_work_queue. During a device shutdown we do the
same thing after vhost_scsi_clear_endpoint has cleared the backends.
In the next patches we will be able to kill the vhost_task before we
have cleared the endpoint. In that case, vhost_vq_work_queue can fail
and we will leak the event's memory. This has handle the failure by
just freeing the event. This is safe to do, because
vhost_vq_work_queue will only return failure for us when the vhost_task
is killed and so userspace will not be able to handle events if we
sent them.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Message-Id: <20240316004707.45557-2-michael.christie@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 53d5ac2 commit 36e493d
1 file changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
| 500 | + | |
501 | 501 | | |
502 | | - | |
503 | | - | |
504 | 502 | | |
505 | 503 | | |
506 | 504 | | |
507 | 505 | | |
508 | 506 | | |
509 | 507 | | |
510 | 508 | | |
511 | | - | |
| 509 | + | |
| 510 | + | |
512 | 511 | | |
513 | 512 | | |
514 | 513 | | |
515 | 514 | | |
516 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
517 | 523 | | |
518 | 524 | | |
519 | 525 | | |
| |||
1509 | 1515 | | |
1510 | 1516 | | |
1511 | 1517 | | |
1512 | | - | |
| 1518 | + | |
| 1519 | + | |
1513 | 1520 | | |
1514 | 1521 | | |
1515 | 1522 | | |
| |||
0 commit comments