NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-mvme68k/61075: zs panic during auto configuration on a MVME147 board



>Number:         61075
>Category:       port-mvme68k
>Synopsis:       zs panic during auto configuration on a MVME147 board
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-mvme68k-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 25 10:00:00 +0000 2026
>Originator:     Olivier De Smet
>Release:        NetBSD 11.1
>Organization:
>Environment:
NetBSD mvme147 11.1 NetBSD 11.1 (GENERIC) #0: Tue Nov 24 08:57:09 CET 2026  olivier@imrryr:/home/olivier/NetBSD/usr/obj/sys/arch/mvme68k/compile/GENERIC mvme68k
>Description:
When making a emulator for a MVME147 board I encounter the following problem.

When initializing the scc, netbsd do the first channel then the second channel. On my system an
interrupt can arise between those 2 initializations, making the system panic.

In the file /src/system/arch/mvme68k/dev/zs.c :
in hard_shared() if the zs chip is half initialized (first channel only) and if an interrupt arise, there is an access on the second channel and a panic occurs (near line 271 272) as it access a NULL structure.

 
>How-To-Repeat:
Happened only in my emulated environnement, I do not have access to a real board.

But anyway, there is a time slice when initializing a real device, if an interrupt occurs, the same panic will occurs.

Every boot leads to a panic after initialising the first channel.
>Fix:
add a guard against accessing non initialized channels. Anyway NO interrupts should be taken until the chip is fully initialized.
--------------------------
--- zs.c.orig	2026-11-25 08:28:07.903295987 +0100
+++ zs.c	2026-11-25 08:27:49.407359322 +0100
@@ -267,7 +267,10 @@
 	rval = 0;
 	for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) {
 		zsc = device_lookup_private(&zsc_cd, unit);
-		if (zsc != NULL && zsc_intr_hard(zsc)) {
+		if (zsc == NULL ||
+		    zsc->zsc_cs[0] == NULL || zsc->zsc_cs[1] == NULL)
+			continue;
+		if (zsc_intr_hard(zsc)) {			
 			if ((zsc->zsc_cs[0]->cs_softreq) ||
 			    (zsc->zsc_cs[1]->cs_softreq))
 				softint_schedule(zsc->zsc_softintr_cookie);
--------------------------




Home | Main Index | Thread Index | Old Index