Subject: Re: kern/14993: trying to change the media of a running tl interface causes a panic
To: None <netbsd-bugs@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 12/18/2001 19:16:47
In article <20011218162636.493.qmail@qmail.endersgame.net>,
 <dive@endersgame.net> wrote:

This patch looks incorrect, is this the code you are really running?
You assign 'sc = ifp->if_softc', before you check if ifp is NULL.

christos

>--- sys.orig/dev/pci/if_tl.c	Tue Nov 13 02:48:45 2001
>+++ sys/dev/pci/if_tl.c	Tue Dec 18 10:57:40 2001
>@@ -1406,9 +1406,15 @@
> tl_mediachange(ifp)
> 	struct ifnet *ifp;
> {
>-
>-	if (ifp->if_flags & IFF_UP)
>-		tl_init(ifp->if_softc);
>+	tl_softc_t *sc = ifp->if_softc;
>+	/*
>+	 * this should never be called with a null pointer arg
>+	 */
>+	if (ifp == NULL) {
>+		printf("tl_mediachange: (struct ifnet *)ifp == NULL! (not changing
>media)\n");
>+		return(0);
>+	}
>+	mii_mediachg(&sc->tl_mii);
> 	return (0);
> }
> 
>>Release-Note:
>>Audit-Trail:
>>Unformatted:
> note: this only started happening a few days ago that i noticed, so maybe it
> was some recent change?