diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-06-15 04:13:59 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-06-15 04:13:59 +0000 |
commit | 292410a6b8e787b12658c7d87f2bbaeeb273723a (patch) | |
tree | 70b7afe3c67b71a8a1ca81eddfa8ac26528ae28c /sys/net/raw_cb.c | |
parent | 029226f3a85acf1d4be6aa09215d8e97ded96cb0 (diff) | |
download | FreeBSD-src-292410a6b8e787b12658c7d87f2bbaeeb273723a.zip FreeBSD-src-292410a6b8e787b12658c7d87f2bbaeeb273723a.tar.gz |
Lock down rawcb_list, a global list of control blocks for raw sockets,
using rawcb_mtx. Hold this mutex while modifying or iterating over
the control list; this means that the mutex is held over calls into
socket delivery code, which no longer causes a lock order reversal as
the routing socket code uses a netisr to avoid recursing socket ->
routing -> socket.
Note: Locking of IPsec consumers of rawcb_list is not included in this
commit.
Diffstat (limited to 'sys/net/raw_cb.c')
-rw-r--r-- | sys/net/raw_cb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c index 1e293af..04b4516 100644 --- a/sys/net/raw_cb.c +++ b/sys/net/raw_cb.c @@ -51,6 +51,7 @@ * redo address binding to allow wildcards */ +struct mtx rawcb_mtx; struct rawcb_list_head rawcb_list; const static u_long raw_sendspace = RAWSNDQ; @@ -81,7 +82,9 @@ raw_attach(so, proto) rp->rcb_socket = so; rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; rp->rcb_proto.sp_protocol = proto; + mtx_lock(&rawcb_mtx); LIST_INSERT_HEAD(&rawcb_list, rp, list); + mtx_unlock(&rawcb_mtx); return (0); } |