summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2010-01-07 00:11:16 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2010-01-07 00:11:16 +0000
commit1cae51fe36206b42d2dfbed75d7ebe2f72a9094c (patch)
treef774700e5624beb662b5417fd44027049e2c3e5e
parent1b9e4d0ed7d6a4ddf47635b9b490c41aee1ea81d (diff)
warn if scsi_done has been called twice on an xs in the scsi_xs_sync path
rather than panic. ok krw@
-rw-r--r--sys/scsi/scsi_base.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 9164833a213..d0614255c39 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.151 2010/01/04 11:46:17 dlg Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.152 2010/01/07 00:11:15 dlg Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -808,6 +808,14 @@ scsi_xs_sync_done(struct scsi_xfer *xs)
{
struct mutex *cookie = xs->cookie;
+ if (cookie == NULL) {
+#ifdef DIAGNOSTIC
+ sc_print_addr(xs->sc_link);
+ printf("scsi_done already called on xs(%p)\n", xs);
+#endif
+ return;
+ }
+
mtx_enter(cookie);
xs->cookie = NULL;
if (!ISSET(xs->flags, SCSI_NOSLEEP))