Module Name: src
Committed By: christos
Date: Mon Oct 21 18:37:47 UTC 2019
Modified Files:
src/sys/dev/ata: ata.c
Log Message:
Fix assert_sleepable() panic by allocating with NOSLEEP. The alternative is
to unlock and relock the channel, but seems more dangerous to do so.
To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/ata/ata.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.c
diff -u src/sys/dev/ata/ata.c:1.151 src/sys/dev/ata/ata.c:1.152
--- src/sys/dev/ata/ata.c:1.151 Mon Oct 14 20:13:53 2019
+++ src/sys/dev/ata/ata.c Mon Oct 21 14:37:47 2019
@@ -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_alloc_drives(struct ata_channel *
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;