summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2010-01-07 00:11:15 +0000
committerdlg <dlg@openbsd.org>2010-01-07 00:11:15 +0000
commitfb08c3c15d5c907dba1a33e3bfcf353bb84da252 (patch)
tree4364319ca3d4b7903b42e0af85d21ec37269e718
parentmiscellaneous cleanup: (diff)
downloadwireguard-openbsd-fb08c3c15d5c907dba1a33e3bfcf353bb84da252.tar.xz
wireguard-openbsd-fb08c3c15d5c907dba1a33e3bfcf353bb84da252.zip
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))