From owner-svn-src-head@FreeBSD.ORG Tue Aug 7 18:50:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5802110657D0; Tue, 7 Aug 2012 18:50:34 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40A5D8FC15; Tue, 7 Aug 2012 18:50:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q77IoYTS093330; Tue, 7 Aug 2012 18:50:34 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q77IoYSi093328; Tue, 7 Aug 2012 18:50:34 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201208071850.q77IoYSi093328@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 7 Aug 2012 18:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239131 - head/sys/geom/gate X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2012 18:50:34 -0000 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%s\n", indent, "read-only"); } else if ((sc->sc_flags & G_GATE_FLAG_WRITEONLY) != 0) {