diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-11-03 12:49:43 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-11-03 12:49:43 +0000 |
commit | 4f4cb2b2ad43bc37dbc11566931f4abc773bf62f (patch) | |
tree | cbcdfdc98cbe99481d3c765d6dad97bafc0fda83 /sys | |
parent | 06f5c3a735aa549ac6aa753acf1a4b3cc47c5b1f (diff) |
There is no way SS_NOFDREF is set on a raw socket in raw_usrreq for
PRU_DISCONNECT or PRU_ABORT.
So raw_disconnect() and sofree() return immediately so remove the dead
code.
Also the following call to soisdisconnected() would be a
use after free.
This removes the last calls to raw_disconnect() so tedu it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/raw_cb.c | 12 | ||||
-rw-r--r-- | sys/net/raw_cb.h | 3 | ||||
-rw-r--r-- | sys/net/raw_usrreq.c | 5 |
3 files changed, 3 insertions, 17 deletions
diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c index 107ccc37964..7fdedb9ab89 100644 --- a/sys/net/raw_cb.c +++ b/sys/net/raw_cb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_cb.c,v 1.13 2017/11/02 14:01:18 florian Exp $ */ +/* $OpenBSD: raw_cb.c,v 1.14 2017/11/03 12:49:42 florian Exp $ */ /* $NetBSD: raw_cb.c,v 1.9 1996/02/13 22:00:39 christos Exp $ */ /* @@ -104,13 +104,3 @@ raw_do_detach(struct rawcb *rp) sofree(so); free((caddr_t)(rp), M_PCB, 0); } - -/* - * Disconnect and possibly release resources. - */ -void -raw_disconnect(struct rawcb *rp) -{ - if (rp->rcb_socket->so_state & SS_NOFDREF) - raw_do_detach(rp); -} diff --git a/sys/net/raw_cb.h b/sys/net/raw_cb.h index aba508b1c96..3a8296f2ca3 100644 --- a/sys/net/raw_cb.h +++ b/sys/net/raw_cb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_cb.h,v 1.13 2017/11/02 14:01:18 florian Exp $ */ +/* $OpenBSD: raw_cb.h,v 1.14 2017/11/03 12:49:42 florian Exp $ */ /* $NetBSD: raw_cb.h,v 1.9 1996/02/13 22:00:41 christos Exp $ */ /* @@ -58,7 +58,6 @@ struct rawcb { int raw_attach(struct socket *, int); int raw_detach(struct socket *); void raw_do_detach(struct rawcb *); -void raw_disconnect(struct rawcb *); void raw_init(void); int raw_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index 5f1d1c43479..4b32be9ad24 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_usrreq.c,v 1.33 2017/11/02 14:01:18 florian Exp $ */ +/* $OpenBSD: raw_usrreq.c,v 1.34 2017/11/03 12:49:42 florian Exp $ */ /* $NetBSD: raw_usrreq.c,v 1.11 1996/02/13 22:00:43 christos Exp $ */ /* @@ -78,7 +78,6 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, error = ENOTCONN; break; } - raw_disconnect(rp); soisdisconnected(so); break; @@ -111,8 +110,6 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, break; case PRU_ABORT: - raw_disconnect(rp); - sofree(so); soisdisconnected(so); break; |