cvs commit: src/sys/net if.c

Robert Watson rwatson at
Wed Aug 24 04:45:03 GMT 2005

rwatson     2005-08-24 04:45:02 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_6)
    sys/net              if.c 
  Merge if.c:1.240, if.c:1.241, if.c:1.242 from HEAD to RELENG_6, which
  correct nits in the addition of if_addr_mtx:
    Initialize the if_addr mutex in if_alloc() rather than waiting until
    if_attach().  This allows ethernet drivers to use it in their routines
    to program their MAC filters before ether_ifattach() is called (de(4) is
    one such driver).  Also, the if_addr mutex is destroyed in if_free()
    rather than if_detach(), so there was another potential bug in that a
    driver that failed during attach and called if_free() without having
    called ether_ifattach() would have tried to destroy an uninitialized
    Reported by:    Holm Tiffe holm at freibergnet dot de
    Discussed with: rwatson
    destroy lock _before_ free'ing the structure it resides in
    - Move IF_ADDR_LOCK_DESTROY(ifp) from if_free to if_free_type.
    - Add a note that additions should be made to if_free_type and not
      if_free to help avoid this in the future.
    This apparently fixes a use after free in if_bridge and may fix bugs
    in other direct if_free_type consumers.
    Reported by:    thompsa
  Approved by:    re (hrs)
  Revision   Changes    Path  +3 -3      src/sys/net/if.c

More information about the cvs-src mailing list