[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/37] scsi-disk: do not complete canceled UNMAP req
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 14/37] scsi-disk: do not complete canceled UNMAP requests |
Date: |
Tue, 2 Apr 2013 16:45:19 -0500 |
From: Paolo Bonzini <address@hidden>
Canceled requests should never be completed, and doing that could cause
accesses to a NULL hba_private field.
Cc: address@hidden
Reported-by: Stefan Priebe <address@hidden>
Tested-by: Stefan Priebe <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
(cherry picked from commit d0242eadc5bba4f3abe34bc5d536bbfb81aa9891)
Signed-off-by: Michael Roth <address@hidden>
---
hw/scsi-disk.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 6bc739d..c9c983a 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1493,13 +1493,17 @@ static void scsi_unmap_complete(void *opaque, int ret)
uint32_t nb_sectors;
r->req.aiocb = NULL;
+ if (r->req.io_canceled) {
+ goto done;
+ }
+
if (ret < 0) {
if (scsi_handle_rw_error(r, -ret)) {
goto done;
}
}
- if (data->count > 0 && !r->req.io_canceled) {
+ if (data->count > 0) {
sector_num = ldq_be_p(&data->inbuf[0]);
nb_sectors = ldl_be_p(&data->inbuf[8]) & 0xffffffffULL;
if (!check_lba_range(s, sector_num, nb_sectors)) {
@@ -1516,10 +1520,9 @@ static void scsi_unmap_complete(void *opaque, int ret)
return;
}
+ scsi_req_complete(&r->req, GOOD);
+
done:
- if (data->count == 0) {
- scsi_req_complete(&r->req, GOOD);
- }
if (!r->req.io_canceled) {
scsi_req_unref(&r->req);
}
--
1.7.9.5
- [Qemu-devel] [PATCH 04/37] tap: forbid creating multiqueue tap when hub is used, (continued)
- [Qemu-devel] [PATCH 04/37] tap: forbid creating multiqueue tap when hub is used, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 05/37] qemu-char.c: fix waiting for telnet connection message, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 06/37] net: reduce the unnecessary memory allocation of multiqueue, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 08/37] vga: fix byteswapping., Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 09/37] qmp: netdev_add is like -netdev, not -net, fix documentation, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 07/37] help: add docs for multiqueue tap options, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 10/37] qemu-ga: make guest-sync-delimited available during fsfreeze, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 11/37] scsi-disk: handle io_canceled uniformly and correctly, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 12/37] iscsi: look for pkg-config file too, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 13/37] scsi: do not call scsi_read_data/scsi_write_data for a canceled request, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 14/37] scsi-disk: do not complete canceled UNMAP requests,
Michael Roth <=
- [Qemu-devel] [PATCH 15/37] rtc-test: Fix test failures with recent glib, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 16/37] Allow virtio-net features for legacy s390 virtio bus, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 17/37] pseries: Add compatible property to root of device tree, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 18/37] qcow2: make is_allocated return true for zero clusters, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 19/37] qemu-ga: use key-value store to avoid recycling fd handles after restart, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 21/37] tcg: Fix occasional TCG broken problem when ldst optimization enabled, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 22/37] virtio-ccw: Queue sanity check for notify hypercall., Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 20/37] qga/main.c: Don't use g_key_file_get/set_int64, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 23/37] qemu-bridge-helper: force usage of a very high MAC address for the bridge, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 24/37] configure: Require at least spice-protocol-0.12.3, Michael Roth, 2013/04/02