Remove the pcb from the rawcb list before sofree'ing it.

Don't reacquire softnet_lock until after we've freed the pcb.
This commit is contained in:
matt 2008-08-04 06:19:35 +00:00
parent e61fddb8f9
commit cc99e2f48f
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_cb.c,v 1.19 2008/04/24 11:38:37 ad Exp $ */
/* $NetBSD: raw_cb.c,v 1.20 2008/08/04 06:19:35 matt Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_cb.c,v 1.19 2008/04/24 11:38:37 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_cb.c,v 1.20 2008/08/04 06:19:35 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -97,18 +97,18 @@ raw_detach(struct rawcb *rp)
{
struct socket *so = rp->rcb_socket;
so->so_pcb = 0;
so->so_pcb = NULL;
KASSERT(so->so_lock == softnet_lock); /* XXX */
LIST_REMOVE(rp, rcb_list); /* remove last reference */
/* sofree drops the socket's lock. */
sofree(so);
mutex_enter(softnet_lock);
LIST_REMOVE(rp, rcb_list);
#ifdef notdef
if (rp->rcb_laddr)
m_freem(dtom(rp->rcb_laddr));
rp->rcb_laddr = 0;
#endif
free((void *)rp, M_PCB);
mutex_enter(softnet_lock);
}
/*