# Re: timerfd-add-tfd\_notify\_clock\_set-to-watch-for-clock-changes.patch added to -mm tree

- From: Oleg Nesterov \<hidden\>
- Date: 2011-03-11 13:59:25 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2011/03/3688754
- Thread: https://ratatoskr.run/linux-api/2011/03/3688754/t.md

```text
> @@ -218,10 +266,12 @@ SYSCALL_DEFINE4(timerfd_settime, int, uf
>  	 * it to the new values.
>  	 */
>  	for (;;) {
> +		spin_lock(&notifiers_lock);
>  		spin_lock_irq(&ctx->wqh.lock);
> -		if (hrtimer_try_to_cancel(&ctx->tmr) >= 0)
> +		if (!list_empty(&notifiers_list) || hrtimer_try_to_cancel(&ctx->tmr) >= 0)
>  			break;

Confused. Why do we check the global notifiers_list?

IOW. Suppose that this list is not empty and timerfd_settime() is called
without TFD_NOTIFY_CLOCK_SET. Now we are going to reprogramm the timer
without stopping it?

And. What if timerfd_settime(TFD_NOTIFY_CLOCK_SET, utmr => NULL) is called
twice? timerfd_setup() blindly does list_add(), and we corrupt the list, no?

Oleg.
```
