From c68afc9d21d0dfb5c854e7969d90e6be00e77cbd Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Fri, 6 Aug 2004 22:23:53 +0000 Subject: [PATCH] Fix a panic in ata_generic_transaction(). The DMA pointer of the channel was being unconditionally dereferenced but was NULL for PIO requests. Check the request flags for a DMA transaction before dereferencing. Reported by: ceri Tested by: Radek Kozlowski --- sys/dev/ata/ata-lowlevel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c index e305085f03e2..e5589e4760f7 100644 --- a/sys/dev/ata/ata-lowlevel.c +++ b/sys/dev/ata/ata-lowlevel.c @@ -295,7 +295,7 @@ ata_generic_transaction(struct ata_request *request) } /* request finish here */ - if (ch->dma->flags & ATA_DMA_LOADED) + if (request->flags & ATA_R_DMA && ch->dma->flags & ATA_DMA_LOADED) ch->dma->unload(ch); return ATA_OP_FINISHED; }