Skip to content

Commit

Permalink
spapr_vscsi: Error handling fixes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
  • Loading branch information
ozbenh authored and agraf committed Jun 23, 2012
1 parent 5af9873 commit a4d8e8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hw/spapr_vscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,14 +800,16 @@ 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;
}

/* XXX Handle failure differently ? */
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));

Expand Down

0 comments on commit a4d8e8d

Please sign in to comment.