]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
In g_gate_create() there is a window between when g_gate_softc is
authortrociny <trociny@FreeBSD.org>
Sun, 27 Mar 2011 19:56:55 +0000 (19:56 +0000)
committertrociny <trociny@FreeBSD.org>
Sun, 27 Mar 2011 19:56:55 +0000 (19:56 +0000)
commit42e994cbec564b754bf9f8246495852233198cae
tree74c038c0d8f0c581e8fad9b845988794253ba445
parentc0b9051b174edd52b1c981a25a28d77d5133a049
In g_gate_create() there is a window between when g_gate_softc is
registered in g_gate_units array and when its sc_provider field is
filled. If during this period g_gate_units is accessed by another
thread that is checking for provider name collision the crash is
possible.

Fix this by adding sc_name field to struct g_gate_softc. In
g_gate_create() when g_gate_softc is created but sc_provider is still
not sc_name points to provider name stored in the local array.

Approved by: pjd (mentor)
Reported by: Freddie Cash <fjwcash@gmail.com>
MFC after: 1 week
sys/geom/gate/g_gate.c
sys/geom/gate/g_gate.h