Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v retrieving revision 1.169 retrieving revision 1.170 diff -u -p -r1.169 -r1.170 --- src/sys/netinet/udp_usrreq.c 2008/04/23 06:09:05 1.169 +++ src/sys/netinet/udp_usrreq.c 2008/04/24 11:38:38 1.170 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.169 2008/04/23 06:09:05 thorpej Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.170 2008/04/24 11:38:38 ad Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.169 2008/04/23 06:09:05 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.170 2008/04/24 11:38:38 ad Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -1181,9 +1181,11 @@ udp_usrreq(struct socket *so, int req, s s = splsoftnet(); if (req == PRU_PURGEIF) { + mutex_enter(softnet_lock); in_pcbpurgeif0(&udbtable, (struct ifnet *)control); in_purgeif((struct ifnet *)control); in_pcbpurgeif(&udbtable, (struct ifnet *)control); + mutex_exit(softnet_lock); splx(s); return (0); } @@ -1193,7 +1195,9 @@ udp_usrreq(struct socket *so, int req, s if (req != PRU_SEND && req != PRU_SENDOOB && control) panic("udp_usrreq: unexpected control mbuf"); #endif - if (inp == 0 && req != PRU_ATTACH) { + if (req == PRU_ATTACH) { + sosetlock(so); + } else if (inp == 0) { error = EINVAL; goto release; }