Subject: kern/25061: possible infinite loop in mii readreg routines
To: None <>
From: Simon Burge <>
List: netbsd-bugs
Date: 04/06/2004 00:02:09
>Number:         25061
>Category:       kern
>Synopsis:       possible infinite loop in mii readreg routines
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 05 14:03:00 UTC 2004
>Release:        NetBSD 2.0C, april 2004 sources
Wasabi Systems
	Architecture: any
	Machine: any

        Some mii readreg routines in dev/pci/if_sip.c can sometimes lead
        to an infinite kernel loop.

        Two examples are:

        do {
                enphy = bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_ENPHY);
        } while (enphy & ENPHY_ACCESS);


        do {
                val = bus_space_read_4(sc->sc_st, sc->sc_sh, SIP_NS_PHY(reg));
        } while (reg == MII_BMSR && val == 0);


	Code inspection (or try to use a buggy bus_space implementation!).


        Add timeouts like (to pick two at random) dev/pci/if_bge.c or
        arch/mips/alchemy/dev/if_aumac.c.  Should check other drivers as