Module Name:    src
Committed By:   jdolecek
Date:           Wed Nov  7 17:05:54 UTC 2018

Modified Files:
        src/sys/dev/ata: ata_subr.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ata/ata_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ata/ata_subr.c
diff -u src/sys/dev/ata/ata_subr.c:1.7 src/sys/dev/ata/ata_subr.c:1.8
--- src/sys/dev/ata/ata_subr.c:1.7	Mon Oct 22 20:13:47 2018
+++ src/sys/dev/ata/ata_subr.c	Wed Nov  7 17:05:54 2018
@@ -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;
 }
 

Reply via email to