linux/drivers/vhost
Mike Christie 4c363c81f6 vhost-scsi: Fix crash during LUN unmapping
We normally clear the endpoint then unmap LUNs so the devices are fully
shutdown when the LUN is unmapped, but it's legal to unmap before
clearing. If the user does that while TMFs are running then we can end
up crashing.

vhost_scsi_port_unlink assumes that the LUN's tmf struct will always be on
the tmf_queue list. However, if a TMF is running then it will have been
removed while it's executing. If we do a LUN unmap at this time, then
we assume the entry is on the list and just start accessing it and free
it.

This fixes the bug by just allocating the vhost_scsi_tmf struct when it's
needed like is done with the se_tmr struct that's needed when we submit
the TMF. In this path perf is not an issue and we can use GFP_KERNEL
since it won't swing directly back on us, so we don't need to preallocate
the struct.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Message-Id: <20230321020624.13323-3-michael.christie@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-04-04 11:01:58 -04:00
..
iotlb.c vhost_iotlb: split out IOTLB initialization 2022-05-31 12:44:28 -04:00
Kconfig vhost_vdpa: implement IRQ offloading in vhost_vdpa 2020-08-05 11:08:42 -04:00
Makefile vhost: introduce vDPA-based backend 2020-04-02 10:41:40 -04:00
net.c vhost-net: support VIRTIO_F_RING_RESET 2023-02-20 19:26:59 -05:00
scsi.c vhost-scsi: Fix crash during LUN unmapping 2023-04-04 11:01:58 -04:00
test.c vhost-test: remove meaningless debug info 2023-02-20 19:26:58 -05:00
test.h tools/virtio: Add --reset 2020-06-22 12:34:21 -04:00
vdpa.c vhost-vdpa: free iommu domain after last use during cleanup 2023-03-13 02:29:11 -04:00
vhost.c vhost: remove unused paramete 2023-02-20 19:26:58 -05:00
vhost.h vhost: remove unused paramete 2023-02-20 19:26:58 -05:00
vringh.c vringh: use bvec_set_page to initialize a bvec 2023-02-03 10:17:42 -07:00
vsock.c virtio,vhost,vdpa: features, fixes 2023-02-25 11:48:02 -08:00