futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI

FUTEX_LOCK_PI does not require to have the FUTEX_CLOCK_REALTIME bit set
because it has been using CLOCK_REALTIME based absolute timeouts
forever. Due to that, the time namespace adjustment which is applied when
FUTEX_CLOCK_REALTIME is not set, will wrongly take place for FUTEX_LOCK_PI
and wreckage the timeout.

Exclude it from that procedure.

Fixes: c2f7d08cccf4 ("futex: Adjust absolute futex timeouts with per time namespace offset")
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210422194704.984540159@linutronix.de

+2 -2
+2 -2
kernel/futex.c
··· 3780 3780 t = timespec64_to_ktime(ts); 3781 3781 if (cmd == FUTEX_WAIT) 3782 3782 t = ktime_add_safe(ktime_get(), t); 3783 - else if (!(op & FUTEX_CLOCK_REALTIME)) 3783 + else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME)) 3784 3784 t = timens_ktime_to_host(CLOCK_MONOTONIC, t); 3785 3785 tp = &t; 3786 3786 } ··· 3974 3974 t = timespec64_to_ktime(ts); 3975 3975 if (cmd == FUTEX_WAIT) 3976 3976 t = ktime_add_safe(ktime_get(), t); 3977 - else if (!(op & FUTEX_CLOCK_REALTIME)) 3977 + else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME)) 3978 3978 t = timens_ktime_to_host(CLOCK_MONOTONIC, t); 3979 3979 tp = &t; 3980 3980 }