svn commit: r239131 - head/sys/geom/gate

Mikolaj Golub trociny at FreeBSD.org
Tue Aug 7 18:50:34 UTC 2012


Author: trociny
Date: Tue Aug  7 18:50:33 2012
New Revision: 239131
URL: http://svn.freebsd.org/changeset/base/239131

Log:
  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

Modified:
  head/sys/geom/gate/g_gate.c

Modified: head/sys/geom/gate/g_gate.c
==============================================================================
--- head/sys/geom/gate/g_gate.c	Tue Aug  7 13:11:47 2012	(r239130)
+++ head/sys/geom/gate/g_gate.c	Tue Aug  7 18:50:33 2012	(r239131)
@@ -398,7 +398,9 @@ g_gate_dumpconf(struct sbuf *sb, const c
 	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) {


More information about the svn-src-head mailing list