DF-0118 / fix.diff
diff --git a/sys/kern/kern_dmsg.c b/sys/kern/kern_dmsg.c --- a/sys/kern/kern_dmsg.c +++ b/sys/kern/kern_dmsg.c @@ -1759,6 +1759,16 @@ KKASSERT((state->flags & KDMSG_STATE_SUBINSERTED) == 0); KKASSERT(TAILQ_EMPTY(&state->subq)); + /* + * Free any per-state auxiliary allocation (e.g. dios_open / dios_io + * from subr_diskiocom.c) so repeated OPEN/READ-WITH-DELETE cycles + * do not leak M_DEVBUF. + */ + if (state->any.any != NULL) { + kfree(state->any.any, iocom->mmsg); + state->any.any = NULL; + } + if (state != &state->iocom->state0) kfree(state, iocom->mmsg); } |