kern/84686: kernel panic with if_ppp

Gleb Smirnoff glebius at FreeBSD.org
Thu Aug 11 11:50:16 GMT 2005


The following reply was made to PR kern/84686; it has been noted by GNATS.

From: Gleb Smirnoff <glebius at FreeBSD.org>
To: Vladimir <bobahu4 at mail.ru>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: kern/84686: kernel panic with if_ppp
Date: Thu, 11 Aug 2005 15:08:20 +0400

 --/e2eDi0V/xtL+Mc8
 Content-Type: text/plain; charset=koi8-r
 Content-Disposition: inline
 
   Can you please try out this patch.
 
 -- 
 Totus tuus, Glebius.
 GLEBIUS-RIPN GLEB-RIPE
 
 --/e2eDi0V/xtL+Mc8
 Content-Type: text/plain; charset=koi8-r
 Content-Disposition: attachment; filename="ppp.diff"
 
 Index: if_ppp.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/if_ppp.c,v
 retrieving revision 1.106
 diff -u -r1.106 if_ppp.c
 --- if_ppp.c	9 Aug 2005 10:19:58 -0000	1.106
 +++ if_ppp.c	11 Aug 2005 11:01:19 -0000
 @@ -160,22 +160,6 @@
  static int	ppp_clone_create(struct if_clone *, int);
  static void	ppp_clone_destroy(struct ifnet *);
  
 -struct ppp_softc *
 -ppp_for_tty(struct tty *tp)
 -{
 -	struct ppp_softc *sc;
 -
 -	PPP_LIST_LOCK();
 -	LIST_FOREACH(sc, &ppp_softc_list, sc_list) {
 -		if (sc->sc_devp == (void*)tp) {
 -			PPP_LIST_UNLOCK();
 -			return (sc);
 -		}
 -	}
 -	PPP_LIST_UNLOCK();
 -	return (NULL);
 -}
 -
  IFC_SIMPLE_DECLARE(ppp, 0);
  
  /*
 Index: if_pppvar.h
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/if_pppvar.h,v
 retrieving revision 1.23
 diff -u -r1.23 if_pppvar.h
 --- if_pppvar.h	10 Jun 2005 16:49:18 -0000	1.23
 +++ if_pppvar.h	11 Aug 2005 11:01:37 -0000
 @@ -110,4 +110,3 @@
  void	ppp_restart(struct ppp_softc *sc);
  void	ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
  struct	mbuf *ppp_dequeue(struct ppp_softc *sc);
 -struct	ppp_softc *ppp_for_tty(struct tty *);
 Index: ppp_tty.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/ppp_tty.c,v
 retrieving revision 1.67
 diff -u -r1.67 ppp_tty.c
 --- ppp_tty.c	9 Aug 2005 10:19:58 -0000	1.67
 +++ ppp_tty.c	11 Aug 2005 11:03:33 -0000
 @@ -212,6 +212,7 @@
      PPP2IFP(sc)->if_baudrate = tp->t_ospeed;
  
      tp->t_hotchar = PPP_FLAG;
 +    tp->t_lsc = sc;
      ttyflush(tp, FREAD | FWRITE);
  
      /*
 @@ -240,14 +241,13 @@
      struct tty *tp;
      int flag;
  {
 -    register struct ppp_softc *sc;
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      int s;
  
      s = spltty();
      ttyflush(tp, FREAD | FWRITE);
      clist_free_cblocks(&tp->t_canq);
      clist_free_cblocks(&tp->t_outq);
 -    sc = ppp_for_tty(tp);
      if (sc != NULL) {
  	    pppasyncrelinq(sc);
  	    pppdealloc(sc);
 @@ -309,7 +309,7 @@
      struct uio *uio;
      int flag;
  {
 -    register struct ppp_softc *sc = ppp_for_tty(tp);
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      struct mbuf *m, *m0;
      register int s;
      int error = 0;
 @@ -368,7 +368,7 @@
      struct uio *uio;
      int flag;
  {
 -    register struct ppp_softc *sc = ppp_for_tty(tp);
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      struct mbuf *m;
      struct sockaddr dst;
      int error, s;
 @@ -414,7 +414,7 @@
      int flag;
      struct thread *td;
  {
 -    struct ppp_softc *sc = ppp_for_tty(tp);
 +    struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
      int error, s;
  
      if (sc == NULL || tp != (struct tty *) sc->sc_devp)
 @@ -729,7 +729,7 @@
  pppstart(tp)
      register struct tty *tp;
  {
 -    register struct ppp_softc *sc = ppp_for_tty(tp);
 +    register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc;
  
      /*
       * Call output process whether or not there is any output.
 @@ -815,7 +815,7 @@
      struct mbuf *m;
      int ilen, s;
  
 -    sc = ppp_for_tty(tp);
 +    sc = (struct ppp_softc *)tp->t_lsc;
      if (sc == NULL)
  	return 0;
  
 
 --/e2eDi0V/xtL+Mc8--


More information about the freebsd-bugs mailing list