aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-06-18 20:02:38 +0000
committerAlexander Graf <agraf@suse.de>2012-06-24 01:04:45 +0200
commita4d8e8daee324e230b0155915f562743f4fff5d8 (patch)
tree4985a18dea502942518e9ef236c1e8c2b636455a
parent5af9873d301cf5affec57e2f93650e8700f8251a (diff)
downloadqemu-a4d8e8daee324e230b0155915f562743f4fff5d8.zip
qemu-a4d8e8daee324e230b0155915f562743f4fff5d8.tar.gz
qemu-a4d8e8daee324e230b0155915f562743f4fff5d8.tar.bz2
spapr_vscsi: Error handling fixes
We were incorrectly g_free'ing an object that isn't allocated in one error path and failed to release it completely in another This fixes qemu crashes with some cases of IO errors. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--hw/spapr_vscsi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/spapr_vscsi.c b/hw/spapr_vscsi.c
index 037867a..2f09616 100644
--- a/hw/spapr_vscsi.c
+++ b/hw/spapr_vscsi.c
@@ -800,6 +800,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
if (crq->s.IU_length > sizeof(union viosrp_iu)) {
fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
crq->s.IU_length);
+ vscsi_put_req(req);
return;
}
@@ -807,7 +808,8 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
if (spapr_tce_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
crq->s.IU_length)) {
fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
- g_free(req);
+ vscsi_put_req(req);
+ return;
}
memcpy(&req->crq, crq, sizeof(vscsi_crq));