On Sat, Oct 28, 2023 at 09:39:36PM +0000, SeongJae Park wrote: > DAMON_SYSFS can receive DAMOS tried regions update request while kdamond > is already out of the main loop and before_terminate callback > (damon_sysfs_before_terminate() in this case) is not yet called. And > damon_sysfs_handle_cmd() can further be finished before the callback is > invoked. Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock, > which is not locked by anyone. This happens because the callback function > assumes damon_sysfs_cmd_request_callback() should be called before it. > Check if the assumption was true before doing the unlock, to avoid this > problem. > > Link: https://lkml.kernel.org/r/20231007200432.3110-1-sj@xxxxxxxxxx > Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command") > Signed-off-by: SeongJae Park <sj@xxxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> [6.2.x] > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > (cherry picked from commit 76b7069bcc89dec33f03eb08abee165d0306b754) > --- > > I sent this patch yesterday, but seems not archived in lore.kernel.org. > Sending again Cc-ing more mailing lists, to ensure it is sent and others can > find it, to avoid any duplicated works. Now queued up, thanks. greg k-h