summaryrefslogtreecommitdiffstats
path: root/sys/geom/gate
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2012-08-07 18:50:33 +0000
committertrociny <trociny@FreeBSD.org>2012-08-07 18:50:33 +0000
commitbe00f071cddc9f9c2bbae5eb596284e01d71a525 (patch)
tree921d98b38cf3e4095ca6dc89abcf248c346afaaf /sys/geom/gate
parentefa20295a1af25246e6fc2de6593ded0a6695c70 (diff)
downloadFreeBSD-src-be00f071cddc9f9c2bbae5eb596284e01d71a525.zip
FreeBSD-src-be00f071cddc9f9c2bbae5eb596284e01d71a525.tar.gz
In g_gate_dumpconf() always check the result of g_gate_hold().
This fixes "Negative sc_ref" panic possible when sysctl_kern_geom_confxml() is run simultaneously with destroying GATE device. Reviewed by: pjd MFC after: 3 days
Diffstat (limited to 'sys/geom/gate')
-rw-r--r--sys/geom/gate/g_gate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c
index 7282ac9..d1ddd40 100644
--- a/sys/geom/gate/g_gate.c
+++ b/sys/geom/gate/g_gate.c
@@ -398,7 +398,9 @@ g_gate_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
sc = gp->softc;
if (sc == NULL || pp != NULL || cp != NULL)
return;
- g_gate_hold(sc->sc_unit, NULL);
+ sc = g_gate_hold(sc->sc_unit, NULL);
+ if (sc == NULL)
+ return;
if ((sc->sc_flags & G_GATE_FLAG_READONLY) != 0) {
sbuf_printf(sb, "%s<access>%s</access>\n", indent, "read-only");
} else if ((sc->sc_flags & G_GATE_FLAG_WRITEONLY) != 0) {
OpenPOWER on IntegriCloud