diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2006-04-01 15:42:02 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2006-04-01 15:42:02 +0000 |
commit | bc725eafc7f7d0cb3d3746b71b3cad9b2bc9d499 (patch) | |
tree | 7431f8c0d78c14bc446d524dcda6a00888732015 /sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c | |
parent | f7f45ac8e2adcda53ed2c3f4d3801fb2657c3a4b (diff) |
Chance protocol switch method pru_detach() so that it returns void
rather than an error. Detaches do not "fail", they other occur or
the protocol flags SS_PROTOREF to take ownership of the socket.
soclose() no longer looks at so_pcb to see if it's NULL, relying
entirely on the protocol to decide whether it's time to free the
socket or not using SS_PROTOREF. so_pcb is now entirely owned and
managed by the protocol code. Likewise, no longer test so_pcb in
other socket functions, such as soreceive(), which have no business
digging into protocol internals.
Protocol detach routines no longer try to free the socket on detach,
this is performed in the socket code if the protocol permits it.
In rts_detach(), no longer test for rp != NULL in detach, and
likewise in other protocols that don't permit a NULL so_pcb, reduce
the incidence of testing for it during detach.
netinet and netinet6 are not fully updated to this change, which
will be in an upcoming commit. In their current state they may leak
memory or panic.
MFC after: 3 months
Notes
Notes:
svn path=/head/; revision=157370
Diffstat (limited to 'sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c')
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c index d89bdafa0fbf..04bf4262e920 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c @@ -1399,15 +1399,15 @@ ng_btsocket_hci_raw_ctloutput(struct socket *so, struct sockopt *sopt) * Detach raw HCI socket */ -int +void ng_btsocket_hci_raw_detach(struct socket *so) { ng_btsocket_hci_raw_pcb_p pcb = so2hci_raw_pcb(so); - if (pcb == NULL) - return (EINVAL); + KASSERT(pcb != NULL, ("ng_btsocket_hci_raw_detach: pcb == NULL")); + if (ng_btsocket_hci_raw_node == NULL) - return (EINVAL); + return; mtx_lock(&ng_btsocket_hci_raw_sockets_mtx); mtx_lock(&pcb->pcb_mtx); @@ -1422,12 +1422,7 @@ ng_btsocket_hci_raw_detach(struct socket *so) bzero(pcb, sizeof(*pcb)); FREE(pcb, M_NETGRAPH_BTSOCKET_HCI_RAW); - ACCEPT_LOCK(); - SOCK_LOCK(so); so->so_pcb = NULL; - sotryfree(so); - - return (0); } /* ng_btsocket_hci_raw_detach */ /* |