diff options
author | Mike Christie | 2023-03-20 21:06:19 -0500 |
---|---|---|
committer | Michael S. Tsirkin | 2023-04-04 11:01:58 -0400 |
commit | 4c363c81f66c77e0a2394b9a4efa707d122dc544 (patch) | |
tree | 26960124b4d3d4c2c3d052002376e633c2e52cca /tools | |
parent | e508efc3ae7e44eb3caf595a086bfd3824da5b9a (diff) |
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>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions