scsi/scsi-bus: scsi_device_find: don't return unrealized devices
commit8ddf958e8d62ada6395460b91ec5964ef21fed12
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 6 Oct 2020 12:39:01 +0000 (6 15:39 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 12 Oct 2020 15:50:51 +0000 (12 11:50 -0400)
tree72150e6dd63b3641baddf5c02c2aabe2704a975b
parenta23151e8cc8cc08546252dc9c7671171d9c44615
scsi/scsi-bus: scsi_device_find: don't return unrealized devices

The device core first places a device on the bus and then realizes it.
Make scsi_device_find avoid returing such devices to avoid
races in drivers that use an iothread (currently virtio-scsi)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1812399

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200913160259.32145-7-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201006123904.610658-11-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-bus.c