Current-Users archive

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

Re: Kernel panic in 5.99.24



On Fri, Jan 29, 2010 at 08:50:49AM +0200, Martti Kuparinen wrote:
> I found one of those USB-to-PS2 converters in our lab so now my
> keyboard works within DDB. I rebuilt the kernel with
> 
> options         DEBUG           # expensive debugging checks/support
> options         LOCKDEBUG       # expensive locking checks/support
> makeoptions     DEBUG="-g"      # compile full symbol table
> 
> and here are two new pictures of the panic. What next?
> 
> http://kuparinen.org/martti/tmp/DSC01388.JPG
> http://kuparinen.org/martti/tmp/DSC01389.JPG

Martti,

Here is a compilable, but totally untested patch that may fix the
problem.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933
Index: sys/net/agr/if_agr.c
===================================================================
RCS file: /cvsroot/src/sys/net/agr/if_agr.c,v
retrieving revision 1.24
diff -p -u -u -p -r1.24 if_agr.c
--- sys/net/agr/if_agr.c        9 Jun 2009 22:21:54 -0000       1.24
+++ sys/net/agr/if_agr.c        4 Feb 2010 05:30:14 -0000
@@ -174,18 +174,42 @@ agr_unlock(struct agr_softc *sc)
        mutex_exit(&sc->sc_lock);
 }
 
+static bool
+agr_ioctl_needlock(u_long cmd)
+{
+
+       switch (cmd) {
+       case SIOCINITIFADDR:
+               return false;
+#if 0 /* notyet */
+       case SIOCSIFMTU:
+#endif
+       case SIOCSIFFLAGS:
+       case SIOCSETAGR:
+       case SIOCGETAGR:
+       case SIOCADDMULTI:
+       case SIOCDELMULTI:
+       case SIOCIFDESTROY:
+               return true;
+       default:
+               return false;
+       }
+}
+
 void
-agr_ioctl_lock(struct agr_softc *sc)
+agr_ioctl_lock(struct agr_softc *sc, u_long cmd)
 {
 
-       mutex_enter(&sc->sc_ioctl_lock);
+       if (agr_ioctl_needlock(cmd))
+               mutex_enter(&sc->sc_ioctl_lock);
 }
 
 void
-agr_ioctl_unlock(struct agr_softc *sc)
+agr_ioctl_unlock(struct agr_softc *sc, u_long cmd)
 {
 
-       mutex_exit(&sc->sc_ioctl_lock);
+       if (agr_ioctl_needlock(cmd))
+               mutex_exit(&sc->sc_ioctl_lock);
 }
 
 /*
@@ -371,7 +395,7 @@ agr_clone_destroy(struct ifnet *ifp)
        struct agr_softc *sc = ifp->if_softc;
        int error;
 
-       agr_ioctl_lock(sc);
+       agr_ioctl_lock(sc, SIOCIFDESTROY);
 
        AGR_LOCK(sc);
        if (sc->sc_nports > 0) {
@@ -381,7 +405,7 @@ agr_clone_destroy(struct ifnet *ifp)
        }
        AGR_UNLOCK(sc);
 
-       agr_ioctl_unlock(sc);
+       agr_ioctl_unlock(sc, SIOCIFDESTROY);
 
        if (error == 0) {
                if_detach(ifp);
@@ -934,7 +958,7 @@ agrreq_copyout(void *ubuf, struct agrreq
 }
 
 static int
-agr_ioctl(struct ifnet *ifp, u_long cmd, void *data)
+agr_ioctl(struct ifnet *ifp, const u_long cmd, void *data)
 {
        struct agr_softc *sc = ifp->if_softc;
        struct ifreq *ifr = (struct ifreq *)data;
@@ -943,7 +967,7 @@ agr_ioctl(struct ifnet *ifp, u_long cmd,
        int error = 0;
        int s;
 
-       agr_ioctl_lock(sc);
+       agr_ioctl_lock(sc, cmd);
 
        s = splnet();
 
@@ -1025,7 +1049,7 @@ agr_ioctl(struct ifnet *ifp, u_long cmd,
 
        splx(s);
 
-       agr_ioctl_unlock(sc);
+       agr_ioctl_unlock(sc, cmd);
 
        return error;
 }
Index: sys/net/agr/if_agrvar_impl.h
===================================================================
RCS file: /cvsroot/src/sys/net/agr/if_agrvar_impl.h,v
retrieving revision 1.8
diff -p -u -u -p -r1.8 if_agrvar_impl.h
--- sys/net/agr/if_agrvar_impl.h        29 May 2009 04:57:05 -0000      1.8
+++ sys/net/agr/if_agrvar_impl.h        4 Feb 2010 05:30:14 -0000
@@ -125,8 +125,8 @@ struct agr_softc {
 void agr_lock(struct agr_softc *);
 void agr_unlock(struct agr_softc *);
 
-void agr_ioctl_lock(struct agr_softc *);
-void agr_ioctl_unlock(struct agr_softc *);
+void agr_ioctl_lock(struct agr_softc *, u_long);
+void agr_ioctl_unlock(struct agr_softc *, u_long);
 
 int agrport_ioctl(struct agr_port *, u_long, void *);
 


Home | Main Index | Thread Index | Old Index