mirror of https://gitee.com/openkylin/qemu.git
usb-storage: fix NULL pointer dereference.
When a usb packet is canceled we need to check whenever we actually have a scsi request in flight before we try to cancel it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
ebffe2afce
commit
d3ac1a87b2
|
@ -325,7 +325,10 @@ static int usb_msd_handle_control(USBDevice *dev, USBPacket *p,
|
|||
static void usb_msd_cancel_io(USBDevice *dev, USBPacket *p)
|
||||
{
|
||||
MSDState *s = DO_UPCAST(MSDState, dev, dev);
|
||||
scsi_req_cancel(s->req);
|
||||
|
||||
if (s->req) {
|
||||
scsi_req_cancel(s->req);
|
||||
}
|
||||
}
|
||||
|
||||
static int usb_msd_handle_data(USBDevice *dev, USBPacket *p)
|
||||
|
|
Loading…
Reference in New Issue