Skip to content

Commit 2d48202

Browse files
committed
Merge remote-tracking branch 'stable/linux-5.7.y' into v5.7+
2 parents 8299898 + 901e2c6 commit 2d48202

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 5
33
PATCHLEVEL = 7
4-
SUBLEVEL = 3
4+
SUBLEVEL = 4
55
EXTRAVERSION =
66
NAME = Kleptomaniac Octopus
77

lib/vdso/gettimeofday.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ static inline bool vdso_clocksource_ok(const struct vdso_data *vd)
3838
}
3939
#endif
4040

41+
#ifndef vdso_cycles_ok
42+
static inline bool vdso_cycles_ok(u64 cycles)
43+
{
44+
return true;
45+
}
46+
#endif
47+
4148
#ifdef CONFIG_TIME_NS
4249
static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
4350
struct __kernel_timespec *ts)
@@ -62,6 +69,8 @@ static int do_hres_timens(const struct vdso_data *vdns, clockid_t clk,
6269
return -1;
6370

6471
cycles = __arch_get_hw_counter(vd->clock_mode);
72+
if (unlikely(!vdso_cycles_ok(cycles)))
73+
return -1;
6574
ns = vdso_ts->nsec;
6675
last = vd->cycle_last;
6776
ns += vdso_calc_delta(cycles, last, vd->mask, vd->mult);
@@ -130,6 +139,8 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk,
130139
return -1;
131140

132141
cycles = __arch_get_hw_counter(vd->clock_mode);
142+
if (unlikely(!vdso_cycles_ok(cycles)))
143+
return -1;
133144
ns = vdso_ts->nsec;
134145
last = vd->cycle_last;
135146
ns += vdso_calc_delta(cycles, last, vd->mask, vd->mult);

0 commit comments

Comments
 (0)