cvs commit: src/sys/netinet6 in6_ifattach.c

Bill Paul wpaul at FreeBSD.org
Sat Sep 13 15:34:53 PDT 2003


wpaul       2003/09/13 15:34:52 PDT

  FreeBSD src repository

  Modified files:
    sys/netinet6         in6_ifattach.c 
  Log:
  The in6_ifattach() routine contains the following code:
  
          in6_pcbpurgeif0(LIST_FIRST(udbinfo.listhead), ifp);
          in6_pcbpurgeif0(LIST_FIRST(ripcbinfo.listhead), ifp);
  
  The problem here is that udbinfo.listhead and ripcbinfo.listhead are
  not initialized during the device probe/attach phase of the kernel
  boot process. So if, for example, a network driver calls ether_ifattach()
  in its foo_attach() routine and then decides that something is wrong
  and calls ether_ifdetach() to reverse the process, we will panic trying
  to dereference the uninitialized list head pointers. (Though the
  same sequence of events performed after the kernel has come up works
  file, i.e. doing kldload if_foo from multiuser.)
  
  Change this to:
  
          if (udbinfo.listhead != NULL)
                  in6_pcbpurgeif0(LIST_FIRST(udbinfo.listhead), ifp);
          if (ripcbinfo.listhead != NULL)
                  in6_pcbpurgeif0(LIST_FIRST(ripcbinfo.listhead), ifp);
  
  to avoid the NULL pointer dereferences.
  
  Revision  Changes    Path
  1.12      +4 -2      src/sys/netinet6/in6_ifattach.c


More information about the cvs-src mailing list