From: dlg Date: Thu, 22 Jan 2015 01:19:51 +0000 (+0000) Subject: bring back r1.80: X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=354866860278a26b5c5efd5583afae061b47a29e;p=openbsd bring back r1.80: pass the size of the softc to free. this time we only dereference the cfattach structure if we actually need it once the refcount has dropped to 0. tested by krw@ who found the original panic r1.80 was backed out for. putting this in again so i can find out when else will break. --- diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index 2c0964cea8e..49838565ae5 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_autoconf.c,v 1.83 2015/01/19 23:01:07 deraadt Exp $ */ +/* $OpenBSD: subr_autoconf.c,v 1.84 2015/01/22 01:19:51 dlg Exp $ */ /* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */ /* @@ -935,8 +935,11 @@ device_ref(struct device *dv) void device_unref(struct device *dv) { + struct cfattach *ca; + dv->dv_ref--; if (dv->dv_ref == 0) { - free(dv, M_DEVBUF, 0); + ca = dv->dv_cfdata->cf_attach; + free(dv, M_DEVBUF, ca->ca_devsize); } }