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.
-/* $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 $ */
/*
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);
}
}