Author: trasz Date: Mon Oct 19 20:26:37 2020 New Revision: 366855 URL: https://svnweb.freebsd.org/changeset/base/366855
Log: Fix fallout from r366811. PR: 250442 Reported by: lwhsu Reviewed by: mav MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26855 Modified: head/sys/geom/geom_dev.c head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Mon Oct 19 20:08:50 2020 (r366854) +++ head/sys/geom/geom_dev.c Mon Oct 19 20:26:37 2020 (r366855) @@ -346,9 +346,15 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, cp->private = sc; cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); - KASSERT(error == 0 || error == ENXIO, - ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); - + if (error != 0) { + printf("%s: g_dev_taste(%s) failed to g_attach, error=%d\n", + __func__, pp->name, error); + g_destroy_consumer(cp); + g_destroy_geom(gp); + mtx_destroy(&sc->sc_mtx); + g_free(sc); + return (NULL); + } make_dev_args_init(&args); args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; args.mda_devsw = &g_dev_cdevsw; Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Mon Oct 19 20:08:50 2020 (r366854) +++ head/sys/geom/uzip/g_uzip.c Mon Oct 19 20:26:37 2020 (r366855) @@ -707,11 +707,11 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp gp = g_new_geomf(mp, GUZ_DEV_NAME("%s"), pp->name); cp = g_new_consumer(gp); error = g_attach(cp, pp); - if (error == 0) - error = g_access(cp, 1, 0, 0); - if (error) { + if (error != 0) + goto e0; + error = g_access(cp, 1, 0, 0); + if (error) goto e1; - } g_topology_unlock(); /* @@ -942,6 +942,7 @@ e2: g_access(cp, -1, 0, 0); e1: g_detach(cp); +e0: g_destroy_consumer(cp); g_destroy_geom(gp); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"