Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev/ic Pull up following revision(s) (requested by ts...
details: https://anonhg.NetBSD.org/src/rev/e6cae58d73f9
branches: netbsd-9
changeset: 964328:e6cae58d73f9
user: martin <martin%NetBSD.org@localhost>
date: Tue Mar 09 15:47:07 2021 +0000
description:
Pull up following revision(s) (requested by tsutsui in ticket #1228):
sys/dev/ic/mb89352.c: revision 1.58
Fix a possible race condition in spc_msgin() in NO_MANUAL_XFER case.
To avoid the race, check SSTS and INTS after XFR command as
spc_pio_datain() does.
Reported from isaki@, observed on nono emulator.
diffstat:
sys/dev/ic/mb89352.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (46 lines):
diff -r b9540d99c306 -r e6cae58d73f9 sys/dev/ic/mb89352.c
--- a/sys/dev/ic/mb89352.c Tue Mar 09 15:44:50 2021 +0000
+++ b/sys/dev/ic/mb89352.c Tue Mar 09 15:47:07 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mb89352.c,v 1.57 2018/09/03 16:29:31 riastradh Exp $ */
+/* $NetBSD: mb89352.c,v 1.57.4.1 2021/03/09 15:47:07 martin Exp $ */
/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
/*-
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.57 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.57.4.1 2021/03/09 15:47:07 martin Exp $");
#ifdef DDB
#define integrate
@@ -932,6 +932,7 @@
*/
for (;;) {
#ifdef NO_MANUAL_XFER /* XXX */
+ uint8_t intstat;
if (bus_space_read_1(iot, ioh, INTS) != 0) {
/*
* Target left MESSAGE IN, probably because it
@@ -960,12 +961,18 @@
#else
bus_space_write_1(iot, ioh, SCMD, SCMD_XFR | SCMD_PROG_XFR);
#endif
+ intstat = 0;
for (;;) {
if ((bus_space_read_1(iot, ioh, SSTS) &
SSTS_DREG_EMPTY) == 0)
break;
- if (bus_space_read_1(iot, ioh, INTS) != 0)
+ /*
+ * We have to read INTS before checking SSTS to avoid
+ * race between SSTS_DREG_EMPTY and INTS_CMD_DONE.
+ */
+ if (intstat != 0)
goto out;
+ intstat = bus_space_read_1(iot, ioh, INTS);
}
msg = bus_space_read_1(iot, ioh, DREG);
#else
Home |
Main Index |
Thread Index |
Old Index