Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ata Make sure a channel has drives attached before r...



details:   https://anonhg.NetBSD.org/src/rev/013919fe4db1
branches:  trunk
changeset: 789117:013919fe4db1
user:      blymn <blymn%NetBSD.org@localhost>
date:      Wed Aug 07 12:50:17 2013 +0000

description:
Make sure a channel has drives attached before resetting it otherwise
wdc_reset will panic the kernel due to a null derefrence of ch_drives.

diffstat:

 sys/dev/ata/ata.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 7214e6d8ff8d -r 013919fe4db1 sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Wed Aug 07 06:55:00 2013 +0000
+++ b/sys/dev/ata/ata.c Wed Aug 07 12:50:17 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata.c,v 1.127 2013/04/03 17:15:07 bouyer Exp $ */
+/*     $NetBSD: ata.c,v 1.128 2013/08/07 12:50:17 blymn Exp $  */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.127 2013/04/03 17:15:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.128 2013/08/07 12:50:17 blymn Exp $");
 
 #include "opt_ata.h"
 
@@ -1678,7 +1678,10 @@
        KASSERT(chp->ch_queue->queue_freeze > 0);
        /* unfreeze the queue and reset drives */
        chp->ch_queue->queue_freeze--;
-       ata_reset_channel(chp, AT_WAIT);
+
+       /* reset channel only if there are drives attached */
+       if (chp->ch_ndrives > 0)
+               ata_reset_channel(chp, AT_WAIT);
        splx(s);
 
        return true;



Home | Main Index | Thread Index | Old Index