git: kernel - Serialize ifioctl() with a mutex

Matthew Dillon dillon at
Tue Jun 7 14:01:24 PDT 2011

commit 9683f229e6862b5d21b610cac390a826ba6b51de
Author: Matthew Dillon <dillon at>
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
    * 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
    * 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>

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

DragonFly BSD source repository

More information about the Commits mailing list