diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-01-23 01:37:19 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-01-23 01:37:19 +0000 |
commit | 89a4ab6c9c05d9ecaa674b0d4b304ef763151981 (patch) | |
tree | c6407fd1a69e0e1e0d8105d37bbe22827a9285fb /sys/arch/sparc64 | |
parent | 242efd14e6fd518c20780b1bdedaf2408b313a97 (diff) |
Don't blindly continue if and hv_ldc_copy() call fails. For now, simply
clean up and return without ACKing any descriptors. That means the client
probably hangs. Some thought is needed on what the correct way to handle
these conditions is. Made me spot a small memory leak, which is fixed asi
a bonus.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/dev/vdsp.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/sys/arch/sparc64/dev/vdsp.c b/sys/arch/sparc64/dev/vdsp.c index bdc89b76622..4d788a5b631 100644 --- a/sys/arch/sparc64/dev/vdsp.c +++ b/sys/arch/sparc64/dev/vdsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsp.c,v 1.20 2014/01/23 00:19:09 kettenis Exp $ */ +/* $OpenBSD: vdsp.c,v 1.21 2014/01/23 01:37:18 kettenis Exp $ */ /* * Copyright (c) 2009, 2011 Mark Kettenis * @@ -1093,8 +1093,11 @@ vdsp_read(void *arg1, void *arg2) nbytes = MIN(nbytes, PAGE_SIZE - (off & PAGE_MASK)); err = hv_ldc_copy(lc->lc_id, LDC_COPY_OUT, dm->cookie[i].addr + off, pa, nbytes, &nbytes); - if (err != H_EOK) + if (err != H_EOK) { printf("%s: hv_ldc_copy: %d\n", __func__, err); + free(buf, M_DEVBUF); + return; + } va += nbytes; size -= nbytes; off += nbytes; @@ -1160,8 +1163,11 @@ vdsp_read_dring(void *arg1, void *arg2) nbytes = MIN(nbytes, PAGE_SIZE - (off & PAGE_MASK)); err = hv_ldc_copy(lc->lc_id, LDC_COPY_OUT, vd->cookie[i].addr + off, pa, nbytes, &nbytes); - if (err != H_EOK) + if (err != H_EOK) { printf("%s: hv_ldc_copy: %d\n", __func__, err); + free(buf, M_DEVBUF); + return; + } va += nbytes; size -= nbytes; off += nbytes; @@ -1210,8 +1216,11 @@ vdsp_write_dring(void *arg1, void *arg2) nbytes = MIN(nbytes, PAGE_SIZE - (off & PAGE_MASK)); err = hv_ldc_copy(lc->lc_id, LDC_COPY_IN, vd->cookie[i].addr + off, pa, nbytes, &nbytes); - if (err != H_EOK) + if (err != H_EOK) { printf("%s: hv_ldc_copy: %d\n", __func__, err); + free(buf, M_DEVBUF); + return; + } va += nbytes; size -= nbytes; off += nbytes; @@ -1331,8 +1340,11 @@ vdsp_get_vtoc(void *arg1, void *arg2) nbytes = MIN(nbytes, PAGE_SIZE - (off & PAGE_MASK)); err = hv_ldc_copy(lc->lc_id, LDC_COPY_OUT, vd->cookie[i].addr + off, pa, nbytes, &nbytes); - if (err != H_EOK) + if (err != H_EOK) { printf("%s: hv_ldc_copy: %d\n", __func__, err); + free(vt, M_DEVBUF); + return; + } va += nbytes; size -= nbytes; off += nbytes; @@ -1377,8 +1389,11 @@ vdsp_set_vtoc(void *arg1, void *arg2) nbytes = MIN(nbytes, PAGE_SIZE - (off & PAGE_MASK)); err = hv_ldc_copy(lc->lc_id, LDC_COPY_IN, vd->cookie[i].addr + off, pa, nbytes, &nbytes); - if (err != H_EOK) + if (err != H_EOK) { printf("%s: hv_ldc_copy: %d\n", __func__, err); + free(vt, M_DEVBUF); + return; + } va += nbytes; size -= nbytes; off += nbytes; @@ -1508,8 +1523,11 @@ vdsp_get_diskgeom(void *arg1, void *arg2) nbytes = MIN(nbytes, PAGE_SIZE - (off & PAGE_MASK)); err = hv_ldc_copy(lc->lc_id, LDC_COPY_OUT, vd->cookie[i].addr + off, pa, nbytes, &nbytes); - if (err != H_EOK) + if (err != H_EOK) { printf("%s: hv_ldc_copy: %d\n", __func__, err); + free(vg, M_DEVBUF); + return; + } va += nbytes; size -= nbytes; off += nbytes; @@ -1519,6 +1537,8 @@ vdsp_get_diskgeom(void *arg1, void *arg2) } } + free(vg, M_DEVBUF); + /* ACK the descriptor. */ vd->status = 0; vd->hdr.dstate = VIO_DESC_DONE; |