git: kernel - Serialize ifioctl() with a mutex

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Jun 7 14:01:24 PDT 2011


commit 9683f229e6862b5d21b610cac390a826ba6b51de
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Jun 7 13:50:40 2011 -0700

    kernel - Serialize ifioctl() with a mutex
    
    * ifioctl() calls (aka via ifconfig) make various assumptions about the
      stability of certain data structures and can panic otherwise.  Concurrent
      calls to ifioctl via ifconfig can create inconsistencies in the ifnet
      structure.
    
    * Rearrange the ifioctl() code into a fall-through modem, add a struct mtx
      to the ifnet structure, and acquire and release the mutex in ifioctl()
      to enforce stability relative to concurrent ifconfig/ioctl commands
      issued on the interface.
    
    * Fixes a panic reproduced via a while(1):
    
      while (1)
    	  echo -n x
    	  ifconfig re0 inet6 fe80::201:2eff:fe31:5469%re0 &
    	  ifconfig re0 inet6 fe80::201:2eff:fe31:5469%re0 delete &
    	  sleep 0.1
      end
    
    * May fix other related panics.
    
    NOTE: This mutex does not protect internal data structures related to
          network operation.  It is currently being used strictly to serialize
          ifconfig style operations on the interface.
    
    Reported-by: Francois Tigeot <ftigeot at wolfpond.org>

Summary of changes:
 sys/net/if.c     |  162 +++++++++++++++++++++++++++++++++---------------------
 sys/net/if_var.h |    5 +-
 2 files changed, 104 insertions(+), 63 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/9683f229e6862b5d21b610cac390a826ba6b51de


-- 
DragonFly BSD source repository





More information about the Commits mailing list