Date: Tue, 7 Aug 2012 18:50:34 +0000 (UTC) From: Mikolaj Golub <trociny@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r239131 - head/sys/geom/gate Message-ID: <201208071850.q77IoYSi093328@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208071850.q77IoYSi093328>