summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjdolecek <jdolecek@NetBSD.org>2018-11-07 17:05:54 +0000
committerjdolecek <jdolecek@NetBSD.org>2018-11-07 17:05:54 +0000
commitfd5a6f27f47cf5fe439180f9aa7cd56cb6a4f0f3 (patch)
tree177ffc0d412d30c3748fc79d4681510d6ff89c18 /sys/dev
parenta414d2aebc410b9c4bcfc0691f4090b422ff89cc (diff)
don't touch the queue structure in ata_queue_active() if atabus is already
detached from the channel fixes panic on null pointer derefence during shutdown reported privately by Launey Thomas
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/ata_subr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/ata/ata_subr.c b/sys/dev/ata/ata_subr.c
index 1ee4491195c..ae220145fe0 100644
--- a/sys/dev/ata/ata_subr.c
+++ b/sys/dev/ata/ata_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_subr.c,v 1.7 2018/10/22 20:13:47 jdolecek Exp $ */
+/* $NetBSD: ata_subr.c,v 1.8 2018/11/07 17:05:54 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.7 2018/10/22 20:13:47 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_subr.c,v 1.8 2018/11/07 17:05:54 jdolecek Exp $");
#include "opt_ata.h"
@@ -364,6 +364,9 @@ ata_queue_active(struct ata_channel *chp)
{
struct ata_queue *chq = chp->ch_queue;
+ if (chp->ch_flags & ATACH_DETACHED)
+ return 0;
+
return chq->active_xfers_used;
}