fix soabort(): sofree() wants to be called with the lock held
approved by ad
This commit is contained in:
parent
4b476699e2
commit
d41cbd880a
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: uipc_socket.c,v 1.163 2008/04/29 17:35:31 ad Exp $ */
|
/* $NetBSD: uipc_socket.c,v 1.164 2008/05/01 09:21:56 drochner Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc.
|
* Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc.
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.163 2008/04/29 17:35:31 ad Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.164 2008/05/01 09:21:56 drochner Exp $");
|
||||||
|
|
||||||
#include "opt_sock_counters.h"
|
#include "opt_sock_counters.h"
|
||||||
#include "opt_sosend_loan.h"
|
#include "opt_sosend_loan.h"
|
||||||
|
@ -708,12 +708,10 @@ soabort(struct socket *so)
|
||||||
error = (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL,
|
error = (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
refs = --so->so_aborting; /* XXX */
|
refs = --so->so_aborting; /* XXX */
|
||||||
if (error) {
|
if (error || (refs == 0)) {
|
||||||
sofree(so);
|
sofree(so);
|
||||||
} else {
|
} else {
|
||||||
sounlock(so);
|
sounlock(so);
|
||||||
if (refs == 0)
|
|
||||||
sofree(so);
|
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue