Hi!
From: Eric Dumazet edumazet@google.com
commit 56144737e67329c9aaed15f942d46a6302e2e3d8 upstream.
syzbot reported various data-race caused by hrtimer_is_queued() reading timer->state. A READ_ONCE() is required there to silence the warning.
Also add the corresponding WRITE_ONCE() when timer->state is set.
In remove_hrtimer() the hrtimer_is_queued() helper is open coded to avoid loading timer->state twice.
Is there a reason why READ_ONCE is not neccessary in remove_hrtimer?
Should there be comment there explaining it?
Best regards, Pavel
@@ -1002,8 +1004,9 @@ static void __remove_hrtimer(struct hrti static inline int remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart) {
- if (hrtimer_is_queued(timer)) {
u8 state = timer->state;
- u8 state = timer->state;
- if (state & HRTIMER_STATE_ENQUEUED) { int reprogram;
/*