mirror of https://github.com/xqemu/xqemu.git
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>
This commit is contained in:
parent
5af9873d30
commit
a4d8e8daee
|
@ -800,6 +800,7 @@ static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)
|
||||||
if (crq->s.IU_length > sizeof(union viosrp_iu)) {
|
if (crq->s.IU_length > sizeof(union viosrp_iu)) {
|
||||||
fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
|
fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
|
||||||
crq->s.IU_length);
|
crq->s.IU_length);
|
||||||
|
vscsi_put_req(req);
|
||||||
return;
|
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,
|
if (spapr_tce_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,
|
||||||
crq->s.IU_length)) {
|
crq->s.IU_length)) {
|
||||||
fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
|
fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");
|
||||||
g_free(req);
|
vscsi_put_req(req);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
memcpy(&req->crq, crq, sizeof(vscsi_crq));
|
memcpy(&req->crq, crq, sizeof(vscsi_crq));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue