--- linux-2.4.20-quota-ctx/kernel/sys.c 2003-01-30 14:40:56.000000000 +0000 +++ new/kernel/sys.c 2003-03-17 21:53:55.000000000 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -1089,32 +1090,34 @@ } } +spinlock_t ip_info_lock = SPIN_LOCK_UNLOCKED; + /* Decrease the reference count on the ip_info struct Free the struct if the reference count reach 0. */ void sys_release_ip_info (struct iproot_info *ip_info) { + spin_lock(&ip_info_lock); if (ip_info != NULL){ - down_write (&uts_sem); ip_info->refcount--; if (ip_info->refcount == 0){ - // printk ("vfree s_info %d\n",p->pid); + // printk ("%5d vfree ip_info 0x%08x\n", current->pid, ip_info ); vfree (ip_info); } - up_write (&uts_sem); } + spin_unlock(&ip_info_lock); } /* Increase the reference count on the ip_info member of a task */ void sys_assign_ip_info (struct iproot_info *ip_info) { + spin_lock(&ip_info_lock); if (ip_info != NULL){ - down_write (&uts_sem); ip_info->refcount++; - up_write (&uts_sem); } + spin_unlock(&ip_info_lock); } /* --- linux-2.4.20-quota-ctx/net/ipv4/tcp_minisocks.c 2003-01-30 14:40:56.000000000 +0000 +++ new/net/ipv4/tcp_minisocks.c 2003-03-17 14:27:06.000000000 +0000 @@ -651,8 +651,8 @@ struct sk_filter *filter; #endif + sys_assign_ip_info (sk->ip_info); memcpy(newsk, sk, sizeof(*newsk)); - sys_assign_ip_info (newsk->ip_info); newsk->state = TCP_SYN_RECV; /* SANITY */