On Tue, 2025-03-04 at 08:56 +0000, David Howells wrote: > Viacheslav Dubeyko <slava@xxxxxxxxxxx> wrote: > > > + mutex_lock(&monc->mutex); > > kfree(monc->monmap); > > + monc->monmap = NULL; > > + mutex_unlock(&monc->mutex); > > I would do the kfree after the locked region: > > mutex_lock(&monc->mutex); > old_monmap = monc->monmap; > monc->monmap = NULL; > mutex_unlock(&monc->mutex); > kfree(old_monmap); > Makes sense to me. I like this way. Let me rework the patch. Thanks, Slava.