diff options
| author | Alexei Starovoitov <[email protected]> | 2022-02-11 13:21:47 -0800 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2022-02-11 13:21:47 -0800 |
| commit | 3df9d803163e1616c2e742be8a7bfc00ac444ea8 (patch) | |
| tree | af717029d58b680d0902dfd4179466a587e46f40 /include/linux | |
| parent | acc3c47394a1790b4023ca316ac46e798338dd1a (diff) | |
| parent | 5eaed6eedbe9612f642ad2b880f961d1c6c8ec2b (diff) | |
Merge branch 'bpf: fix a bpf_timer initialization issue'
Yonghong Song says:
====================
The patch [1] exposed a bpf_timer initialization bug in function
check_and_init_map_value(). With bug fix here, the patch [1]
can be applied with all selftests passed. Please see individual
patches for fix details.
[1] https://lore.kernel.org/bpf/[email protected]/
Changelog:
v3 -> v4:
. move header file in patch #1 to avoid bpf-next merge conflict
v2 -> v3:
. switch patch #1 and patch #2 for better bisecting
v1 -> v2:
. add Fixes tag for patch #1
. rebase against bpf tree
====================
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bpf.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 31a83449808b..d0ad379d1e62 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -209,11 +209,9 @@ static inline bool map_value_has_timer(const struct bpf_map *map) static inline void check_and_init_map_value(struct bpf_map *map, void *dst) { if (unlikely(map_value_has_spin_lock(map))) - *(struct bpf_spin_lock *)(dst + map->spin_lock_off) = - (struct bpf_spin_lock){}; + memset(dst + map->spin_lock_off, 0, sizeof(struct bpf_spin_lock)); if (unlikely(map_value_has_timer(map))) - *(struct bpf_timer *)(dst + map->timer_off) = - (struct bpf_timer){}; + memset(dst + map->timer_off, 0, sizeof(struct bpf_timer)); } /* copy everything but bpf_spin_lock and bpf_timer. There could be one of each. */ |