In the Linux kernel, the following vulnerability has been resolved: mm/damon/sysfs: fix use-after-free in stateshow() stateshow() reads kdamond->damonctx without holding damonsysfslock. This allows a use-after-free race: CPU 0 CPU 1 ----- ----- stateshow() damonsysfsturndamonon() ctx = kdamond->damonctx; mutexlock(&damonsysfslock); damondestroyctx(kdamond->damonctx); kdamond->damonctx = NULL; mutexunlock(&damonsysfslock); damonisrunning(ctx); /* ctx is freed */ mutexlock(&ctx->kdamondlock); /* UAF */ (The race can also occur with damonsysfskdamondsrmdirs() and damonsysfskdamondrelease(), which free or replace the context under damonsysfslock.) Fix by taking damonsysfslock before dereferencing the context, mirroring the locking used in pidshow(). The bug has existed since stateshow() first accessed kdamond->damon_ctx.