summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2021-02-09 01:50:11 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2021-02-09 01:50:11 +0000
commitb071d6d13fe3ef1751f57c89376e563bef4b9cf8 (patch)
tree03a4b9e637c0feb2bd9beb14ada6468fe6b1974f /sys/dev/ic
parent9cf8483d5a368e4af5e740e78bb9c5ea5214cb47 (diff)
Add a barrier between reading the cqe flags and the command ID, which
should ensure that we don't read a stale command ID and complete the wrong scsi io. powerpc64 base builds were crashing like this fairly regularly. ok deraadt@ dlg@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/nvme.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index 2d0168899c3..602f93d1fb3 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nvme.c,v 1.89 2020/10/15 13:22:13 krw Exp $ */
+/* $OpenBSD: nvme.c,v 1.90 2021/02/09 01:50:10 jmatthew Exp $ */
/*
* Copyright (c) 2014 David Gwynne <dlg@openbsd.org>
@@ -994,6 +994,8 @@ nvme_q_complete(struct nvme_softc *sc, struct nvme_queue *q)
if ((flags & NVME_CQE_PHASE) != q->q_cq_phase)
break;
+ membar_consumer();
+
ccb = &sc->sc_ccbs[cqe->cid];
ccb->ccb_done(sc, ccb, cqe);