diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2008-05-31 23:50:33 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2008-05-31 23:50:33 +0000 |
commit | 32a33a07ddcd22c74d13aa34dd341d04a6246f9a (patch) | |
tree | a924aba20f8801b1d0ed09db95f4fb28e209aaf7 | |
parent | a996506f55a2406a0bce4d07012c3536852a3d82 (diff) |
if a dma mapping contains oddly addressed or odd length segments, then we
reject that mapping. this diff cleans up the mapping if it fails those
diagnostics.
found while looking into an issue for krw@
-rw-r--r-- | sys/dev/pci/ahci.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c index 847aac346bc..570095ae942 100644 --- a/sys/dev/pci/ahci.c +++ b/sys/dev/pci/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.139 2008/04/19 01:18:39 djm Exp $ */ +/* $OpenBSD: ahci.c,v 1.140 2008/05/31 23:50:32 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -1427,12 +1427,12 @@ ahci_load_prdt(struct ahci_ccb *ccb) if (addr & 1) { printf("%s: requested DMA at an odd address %llx\n", PORTNAME(ap), (unsigned long long)addr); - return (1); + goto diagerr; } if (dmap->dm_segs[i].ds_len & 1) { printf("%s: requested DMA length %d is not even\n", PORTNAME(ap), (int)dmap->dm_segs[i].ds_len); - return (1); + goto diagerr; } #endif prd->flags = htole32(dmap->dm_segs[i].ds_len - 1); @@ -1447,6 +1447,12 @@ ahci_load_prdt(struct ahci_ccb *ccb) BUS_DMASYNC_PREWRITE); return (0); + +#ifdef DIAGNOSTIC +diagerr: + bus_dmamap_unload(sc->sc_dmat, dmap); + return (1); +#endif } void |