mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
fanotify: stop permission watchdog when timeout is zero
The fanotify permission watchdog can be disabled by writing zero to
fs/fanotify/watchdog_timeout. fanotify_perm_watchdog_group_add() already
checks for a zero timeout before scheduling the watchdog.
However, once the watchdog work has been scheduled, perm_group_watchdog()
unconditionally schedules itself again with the current timeout. If the
sysctl is changed to zero while the work is active, secs_to_jiffies(0)
causes the work to be rescheduled immediately, resulting in a kworker
busy loop.
Read the timeout once in perm_group_watchdog_schedule() and do not
schedule the work when it is zero. This lets a running watchdog stop
after the next execution when the sysctl is set to zero.
Fixes: b8cf8fda52 ("fanotify: add watchdog for permission events")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Link: https://patch.msgid.link/20260730070648.549458-1-chenyichong@uniontech.com
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
44afeafb88
commit
17463fe751
|
|
@ -112,7 +112,12 @@ static DECLARE_DELAYED_WORK(perm_group_work, perm_group_watchdog);
|
|||
|
||||
static void perm_group_watchdog_schedule(void)
|
||||
{
|
||||
schedule_delayed_work(&perm_group_work, secs_to_jiffies(perm_group_timeout));
|
||||
int timeout = READ_ONCE(perm_group_timeout);
|
||||
|
||||
if (!timeout)
|
||||
return;
|
||||
|
||||
schedule_delayed_work(&perm_group_work, secs_to_jiffies(timeout));
|
||||
}
|
||||
|
||||
static void perm_group_watchdog(struct work_struct *work)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user