On Fri, Dec 18, 2015 at 02:10:00PM +0000, Warner Losh wrote: > Author: imp > Date: Fri Dec 18 14:10:00 2015 > New Revision: 292436 > URL: https://svnweb.freebsd.org/changeset/base/292436 > > Log: > It turns out that it's OK to sleep in this context, so use M_WAITOK > for the softc for the delay module. > > Noticed by: rpokala@ > > Modified: > head/sys/geom/sched/gs_delay.c > > Modified: head/sys/geom/sched/gs_delay.c > ============================================================================== > --- head/sys/geom/sched/gs_delay.c Fri Dec 18 11:20:50 2015 > (r292435) > +++ head/sys/geom/sched/gs_delay.c Fri Dec 18 14:10:00 2015 > (r292436) > @@ -201,8 +201,7 @@ g_delay_init(struct g_geom *geom) > { > struct g_delay_softc *sc; > > - /* XXX check whether we can sleep */ > - sc = malloc(sizeof *sc, M_GEOM_SCHED, M_NOWAIT | M_ZERO); > + sc = malloc(sizeof *sc, M_GEOM_SCHED, M_WAITOK | M_ZERO); > sc->sc_geom = geom; > bioq_init(&sc->sc_bioq); > callout_init(&sc->sc_wait, CALLOUT_MPSAFE);
Additionally, this fixed a potential NULL dereference bug. Thanks, -- Shawn Webb HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE
signature.asc
Description: PGP signature