Skip to content

Commit

Permalink
In g_gate_dumpconf() always check the result of g_gate_hold().
Browse files Browse the repository at this point in the history
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
  • Loading branch information
trociny committed Aug 7, 2012
1 parent efa2029 commit be00f07
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/geom/gate/g_gate.c
Expand Up @@ -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) {
Expand Down

0 comments on commit be00f07

Please sign in to comment.