diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-04-05 12:06:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-04-05 12:06:10 +0000 |
commit | fcbdc13b6cdae6d707092cd98d25ceb11e7f9799 (patch) | |
tree | b6ce81c799f10d17f24f6331efd8ab44dc523b22 | |
parent | a58e03d6c40585b8f161ea39f8a0ce628b60e4b7 (diff) |
Deep below wdc_ioc_ata_cmd() it is possible that some controller (present or
future) will try to dma the command buffer to the disk in some way. Use
dma_alloc() to get ahead of this potential failure path.
ok dlg krw
-rw-r--r-- | sys/dev/ic/wdc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 6c15722f96a..aa0edda0e7b 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc.c,v 1.109 2010/09/21 03:33:32 matthew Exp $ */ +/* $OpenBSD: wdc.c,v 1.110 2011/04/05 12:06:09 deraadt Exp $ */ /* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -1960,9 +1960,7 @@ wdc_ioc_ata_cmd(struct ata_drive_datas *drvp, atareq_t *atareq) bzero(&wdc_c, sizeof(wdc_c)); if (atareq->datalen > 0) { - /* XXX dma accessible */ - wdc_c.data = malloc(atareq->datalen, M_TEMP, - M_WAITOK | M_CANFAIL | M_ZERO); + wdc_c.data = dma_alloc(atareq->datalen, PR_NOWAIT | PR_ZERO); if (wdc_c.data == NULL) { err = ENOMEM; goto err; @@ -2034,7 +2032,7 @@ copyout: err: if (wdc_c.data) - free(wdc_c.data, M_TEMP); + dma_free(wdc_c.data, atareq->datalen); return (err); } |