Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata Fix assert_sleepable() panic by allocating with ...



details:   https://anonhg.NetBSD.org/src/rev/ed9298103abd
branches:  trunk
changeset: 966261:ed9298103abd
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Oct 21 18:37:47 2019 +0000

description:
Fix assert_sleepable() panic by allocating with NOSLEEP. The alternative is
to unlock and relock the channel, but seems more dangerous to do so.

diffstat:

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

diffs (29 lines):

diff -r 9ec541d1018e -r ed9298103abd sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Mon Oct 21 18:36:08 2019 +0000
+++ b/sys/dev/ata/ata.c Mon Oct 21 18:37:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata.c,v 1.151 2019/10/15 00:13:53 chs Exp $    */
+/*     $NetBSD: ata.c,v 1.152 2019/10/21 18:37:47 christos 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.151 2019/10/15 00:13:53 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.152 2019/10/21 18:37:47 christos Exp $");
 
 #include "opt_ata.h"
 
@@ -750,7 +750,9 @@
                atabus_free_drives(chp);
        if (chp->ch_drive == NULL) {
                chp->ch_drive = kmem_zalloc(
-                   sizeof(struct ata_drive_datas) * ndrives, KM_SLEEP);
+                   sizeof(struct ata_drive_datas) * ndrives, KM_NOSLEEP);
+               if (chp->ch_drive == NULL)
+                       return ENOMEM;
        }
        for (i = 0; i < ndrives; i++) {
                chp->ch_drive[i].chnl_softc = chp;



Home | Main Index | Thread Index | Old Index